{"action":"created","comment":{"url":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments/210026478","pull_request_review_id":146156955,"id":210026478,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMDAyNjQ3OA==","diff_hunk":"@@ -46,8 +46,14 @@ class HeaderMapImpl : public HeaderMap {\n   static void appendToHeader(HeaderString& header, absl::string_view data);\n \n   HeaderMapImpl();\n-  HeaderMapImpl(const std::initializer_list<std::pair<LowerCaseString, std::string>>& values);\n+  explicit HeaderMapImpl(\n+      const std::initializer_list<std::pair<LowerCaseString, std::string>>& values);\n   HeaderMapImpl(const HeaderMap& rhs);\n+  // The above constructor for HeaderMap is not an actual copy constructor. This also prevent the\n+  // implicit move constructor, moving HeaderMapImpl is unsafe (see HeaderList comments).\n+  HeaderMapImpl(const HeaderMapImpl& rhs);\n+  // Safe copy assignment; this is highly inefficient, don't use this except for tests.\n+  HeaderMapImpl& operator=(const HeaderMapImpl& rhs);","path":"source/common/http/header_map_impl.h","position":12,"original_position":12,"commit_id":"d7d65ad808eeb13c95f6292dc4060f285da0dc9f","original_commit_id":"d7d65ad808eeb13c95f6292dc4060f285da0dc9f","user":{"login":"htuch","id":10914751,"node_id":"MDQ6VXNlcjEwOTE0NzUx","avatar_url":"https://avatars1.githubusercontent.com/u/10914751?v=4","gravatar_id":"","url":"https://api.github.com/users/htuch","html_url":"https://github.com/htuch","followers_url":"https://api.github.com/users/htuch/followers","following_url":"https://api.github.com/users/htuch/following{/other_user}","gists_url":"https://api.github.com/users/htuch/gists{/gist_id}","starred_url":"https://api.github.com/users/htuch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htuch/subscriptions","organizations_url":"https://api.github.com/users/htuch/orgs","repos_url":"https://api.github.com/users/htuch/repos","events_url":"https://api.github.com/users/htuch/events{/privacy}","received_events_url":"https://api.github.com/users/htuch/received_events","type":"User","site_admin":false},"body":"Yes, we can do this then. I'm honestly surprised what a mess this all is. If anyone wants ammunition in the language wars that points to C++ being a time suck and unreasonably complicated for even experienced programmers to work with, this is a prime example.","created_at":"2018-08-14T16:53:11Z","updated_at":"2018-08-14T16:53:11Z","html_url":"https://github.com/envoyproxy/envoy/pull/4129#discussion_r210026478","pull_request_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/4129","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments/210026478"},"html":{"href":"https://github.com/envoyproxy/envoy/pull/4129#discussion_r210026478"},"pull_request":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/4129"}},"in_reply_to_id":210022806},"pull_request":{"url":"https://api.github.com/repos/envoyproxy/envoy/pulls/4129","id":208067582,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA4MDY3NTgy","html_url":"https://github.com/envoyproxy/envoy/pull/4129","diff_url":"https://github.com/envoyproxy/envoy/pull/4129.diff","patch_url":"https://github.com/envoyproxy/envoy/pull/4129.patch","issue_url":"https://api.github.com/repos/envoyproxy/envoy/issues/4129","number":4129,"state":"open","locked":false,"title":"header_map: copy constructor for HeaderMapImpl.","user":{"login":"htuch","id":10914751,"node_id":"MDQ6VXNlcjEwOTE0NzUx","avatar_url":"https://avatars1.githubusercontent.com/u/10914751?v=4","gravatar_id":"","url":"https://api.github.com/users/htuch","html_url":"https://github.com/htuch","followers_url":"https://api.github.com/users/htuch/followers","following_url":"https://api.github.com/users/htuch/following{/other_user}","gists_url":"https://api.github.com/users/htuch/gists{/gist_id}","starred_url":"https://api.github.com/users/htuch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htuch/subscriptions","organizations_url":"https://api.github.com/users/htuch/orgs","repos_url":"https://api.github.com/users/htuch/repos","events_url":"https://api.github.com/users/htuch/events{/privacy}","received_events_url":"https://api.github.com/users/htuch/received_events","type":"User","site_admin":false},"body":"Previously, since we had an implicitly deleted copy constructor, we picked up the implicitly created move constructor. This then performed a move operation on HeaderList, which is not safe to move because it contains iterator elements, which can point to end() and so are not safe when when moved, see the Notes in https://en.cppreference.com/w/cpp/container/list/list.\r\n\r\nIn this PR, we explicitly mark HeaderList as non-copyable (also suppresses the implicit move constructor), then provide an explicit copy constructor and assignment operator for TestHeaderImpl.\r\n\r\nThis appears to resolve the leak in https://github.com/envoyproxy/envoy/pull/4118.\r\n\r\nRisk level: Low\r\nTesting: Unit test added.\r\n\r\nSigned-off-by: Harvey Tuch <htuch@google.com>","created_at":"2018-08-13T18:43:56Z","updated_at":"2018-08-14T16:53:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"48a2cc1451701702897cc269937ee3aa5a11913c","assignee":{"login":"mattklein123","id":6305260,"node_id":"MDQ6VXNlcjYzMDUyNjA=","avatar_url":"https://avatars3.githubusercontent.com/u/6305260?v=4","gravatar_id":"","url":"https://api.github.com/users/mattklein123","html_url":"https://github.com/mattklein123","followers_url":"https://api.github.com/users/mattklein123/followers","following_url":"https://api.github.com/users/mattklein123/following{/other_user}","gists_url":"https://api.github.com/users/mattklein123/gists{/gist_id}","starred_url":"https://api.github.com/users/mattklein123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattklein123/subscriptions","organizations_url":"https://api.github.com/users/mattklein123/orgs","repos_url":"https://api.github.com/users/mattklein123/repos","events_url":"https://api.github.com/users/mattklein123/events{/privacy}","received_events_url":"https://api.github.com/users/mattklein123/received_events","type":"User","site_admin":false},"assignees":[{"login":"mattklein123","id":6305260,"node_id":"MDQ6VXNlcjYzMDUyNjA=","avatar_url":"https://avatars3.githubusercontent.com/u/6305260?v=4","gravatar_id":"","url":"https://api.github.com/users/mattklein123","html_url":"https://github.com/mattklein123","followers_url":"https://api.github.com/users/mattklein123/followers","following_url":"https://api.github.com/users/mattklein123/following{/other_user}","gists_url":"https://api.github.com/users/mattklein123/gists{/gist_id}","starred_url":"https://api.github.com/users/mattklein123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattklein123/subscriptions","organizations_url":"https://api.github.com/users/mattklein123/orgs","repos_url":"https://api.github.com/users/mattklein123/repos","events_url":"https://api.github.com/users/mattklein123/events{/privacy}","received_events_url":"https://api.github.com/users/mattklein123/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/4129/commits","review_comments_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/4129/comments","review_comment_url":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/envoyproxy/envoy/issues/4129/comments","statuses_url":"https://api.github.com/repos/envoyproxy/envoy/statuses/d7d65ad808eeb13c95f6292dc4060f285da0dc9f","head":{"label":"htuch:header-map-copy","ref":"header-map-copy","sha":"d7d65ad808eeb13c95f6292dc4060f285da0dc9f","user":{"login":"htuch","id":10914751,"node_id":"MDQ6VXNlcjEwOTE0NzUx","avatar_url":"https://avatars1.githubusercontent.com/u/10914751?v=4","gravatar_id":"","url":"https://api.github.com/users/htuch","html_url":"https://github.com/htuch","followers_url":"https://api.github.com/users/htuch/followers","following_url":"https://api.github.com/users/htuch/following{/other_user}","gists_url":"https://api.github.com/users/htuch/gists{/gist_id}","starred_url":"https://api.github.com/users/htuch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htuch/subscriptions","organizations_url":"https://api.github.com/users/htuch/orgs","repos_url":"https://api.github.com/users/htuch/repos","events_url":"https://api.github.com/users/htuch/events{/privacy}","received_events_url":"https://api.github.com/users/htuch/received_events","type":"User","site_admin":false},"repo":{"id":80469193,"node_id":"MDEwOlJlcG9zaXRvcnk4MDQ2OTE5Mw==","name":"envoy","full_name":"htuch/envoy","owner":{"login":"htuch","id":10914751,"node_id":"MDQ6VXNlcjEwOTE0NzUx","avatar_url":"https://avatars1.githubusercontent.com/u/10914751?v=4","gravatar_id":"","url":"https://api.github.com/users/htuch","html_url":"https://github.com/htuch","followers_url":"https://api.github.com/users/htuch/followers","following_url":"https://api.github.com/users/htuch/following{/other_user}","gists_url":"https://api.github.com/users/htuch/gists{/gist_id}","starred_url":"https://api.github.com/users/htuch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htuch/subscriptions","organizations_url":"https://api.github.com/users/htuch/orgs","repos_url":"https://api.github.com/users/htuch/repos","events_url":"https://api.github.com/users/htuch/events{/privacy}","received_events_url":"https://api.github.com/users/htuch/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/htuch/envoy","description":"C++ front/service proxy","fork":true,"url":"https://api.github.com/repos/htuch/envoy","forks_url":"https://api.github.com/repos/htuch/envoy/forks","keys_url":"https://api.github.com/repos/htuch/envoy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/htuch/envoy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/htuch/envoy/teams","hooks_url":"https://api.github.com/repos/htuch/envoy/hooks","issue_events_url":"https://api.github.com/repos/htuch/envoy/issues/events{/number}","events_url":"https://api.github.com/repos/htuch/envoy/events","assignees_url":"https://api.github.com/repos/htuch/envoy/assignees{/user}","branches_url":"https://api.github.com/repos/htuch/envoy/branches{/branch}","tags_url":"https://api.github.com/repos/htuch/envoy/tags","blobs_url":"https://api.github.com/repos/htuch/envoy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/htuch/envoy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/htuch/envoy/git/refs{/sha}","trees_url":"https://api.github.com/repos/htuch/envoy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/htuch/envoy/statuses/{sha}","languages_url":"https://api.github.com/repos/htuch/envoy/languages","stargazers_url":"https://api.github.com/repos/htuch/envoy/stargazers","contributors_url":"https://api.github.com/repos/htuch/envoy/contributors","subscribers_url":"https://api.github.com/repos/htuch/envoy/subscribers","subscription_url":"https://api.github.com/repos/htuch/envoy/subscription","commits_url":"https://api.github.com/repos/htuch/envoy/commits{/sha}","git_commits_url":"https://api.github.com/repos/htuch/envoy/git/commits{/sha}","comments_url":"https://api.github.com/repos/htuch/envoy/comments{/number}","issue_comment_url":"https://api.github.com/repos/htuch/envoy/issues/comments{/number}","contents_url":"https://api.github.com/repos/htuch/envoy/contents/{+path}","compare_url":"https://api.github.com/repos/htuch/envoy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/htuch/envoy/merges","archive_url":"https://api.github.com/repos/htuch/envoy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/htuch/envoy/downloads","issues_url":"https://api.github.com/repos/htuch/envoy/issues{/number}","pulls_url":"https://api.github.com/repos/htuch/envoy/pulls{/number}","milestones_url":"https://api.github.com/repos/htuch/envoy/milestones{/number}","notifications_url":"https://api.github.com/repos/htuch/envoy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/htuch/envoy/labels{/name}","releases_url":"https://api.github.com/repos/htuch/envoy/releases{/id}","deployments_url":"https://api.github.com/repos/htuch/envoy/deployments","created_at":"2017-01-30T22:15:11Z","updated_at":"2018-02-22T15:20:07Z","pushed_at":"2018-08-14T15:33:25Z","git_url":"git://github.com/htuch/envoy.git","ssh_url":"git@github.com:htuch/envoy.git","clone_url":"https://github.com/htuch/envoy.git","svn_url":"https://github.com/htuch/envoy","homepage":"https://lyft.github.io/envoy","size":19174,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"envoyproxy:master","ref":"master","sha":"794a001266c2fb1e64bb353f080babeb120d1083","user":{"login":"envoyproxy","id":30125649,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMTI1NjQ5","avatar_url":"https://avatars1.githubusercontent.com/u/30125649?v=4","gravatar_id":"","url":"https://api.github.com/users/envoyproxy","html_url":"https://github.com/envoyproxy","followers_url":"https://api.github.com/users/envoyproxy/followers","following_url":"https://api.github.com/users/envoyproxy/following{/other_user}","gists_url":"https://api.github.com/users/envoyproxy/gists{/gist_id}","starred_url":"https://api.github.com/users/envoyproxy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/envoyproxy/subscriptions","organizations_url":"https://api.github.com/users/envoyproxy/orgs","repos_url":"https://api.github.com/users/envoyproxy/repos","events_url":"https://api.github.com/users/envoyproxy/events{/privacy}","received_events_url":"https://api.github.com/users/envoyproxy/received_events","type":"Organization","site_admin":false},"repo":{"id":65214191,"node_id":"MDEwOlJlcG9zaXRvcnk2NTIxNDE5MQ==","name":"envoy","full_name":"envoyproxy/envoy","owner":{"login":"envoyproxy","id":30125649,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMTI1NjQ5","avatar_url":"https://avatars1.githubusercontent.com/u/30125649?v=4","gravatar_id":"","url":"https://api.github.com/users/envoyproxy","html_url":"https://github.com/envoyproxy","followers_url":"https://api.github.com/users/envoyproxy/followers","following_url":"https://api.github.com/users/envoyproxy/following{/other_user}","gists_url":"https://api.github.com/users/envoyproxy/gists{/gist_id}","starred_url":"https://api.github.com/users/envoyproxy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/envoyproxy/subscriptions","organizations_url":"https://api.github.com/users/envoyproxy/orgs","repos_url":"https://api.github.com/users/envoyproxy/repos","events_url":"https://api.github.com/users/envoyproxy/events{/privacy}","received_events_url":"https://api.github.com/users/envoyproxy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/envoyproxy/envoy","description":"C++ front/service proxy","fork":false,"url":"https://api.github.com/repos/envoyproxy/envoy","forks_url":"https://api.github.com/repos/envoyproxy/envoy/forks","keys_url":"https://api.github.com/repos/envoyproxy/envoy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/envoyproxy/envoy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/envoyproxy/envoy/teams","hooks_url":"https://api.github.com/repos/envoyproxy/envoy/hooks","issue_events_url":"https://api.github.com/repos/envoyproxy/envoy/issues/events{/number}","events_url":"https://api.github.com/repos/envoyproxy/envoy/events","assignees_url":"https://api.github.com/repos/envoyproxy/envoy/assignees{/user}","branches_url":"https://api.github.com/repos/envoyproxy/envoy/branches{/branch}","tags_url":"https://api.github.com/repos/envoyproxy/envoy/tags","blobs_url":"https://api.github.com/repos/envoyproxy/envoy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/envoyproxy/envoy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/envoyproxy/envoy/git/refs{/sha}","trees_url":"https://api.github.com/repos/envoyproxy/envoy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/envoyproxy/envoy/statuses/{sha}","languages_url":"https://api.github.com/repos/envoyproxy/envoy/languages","stargazers_url":"https://api.github.com/repos/envoyproxy/envoy/stargazers","contributors_url":"https://api.github.com/repos/envoyproxy/envoy/contributors","subscribers_url":"https://api.github.com/repos/envoyproxy/envoy/subscribers","subscription_url":"https://api.github.com/repos/envoyproxy/envoy/subscription","commits_url":"https://api.github.com/repos/envoyproxy/envoy/commits{/sha}","git_commits_url":"https://api.github.com/repos/envoyproxy/envoy/git/commits{/sha}","comments_url":"https://api.github.com/repos/envoyproxy/envoy/comments{/number}","issue_comment_url":"https://api.github.com/repos/envoyproxy/envoy/issues/comments{/number}","contents_url":"https://api.github.com/repos/envoyproxy/envoy/contents/{+path}","compare_url":"https://api.github.com/repos/envoyproxy/envoy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/envoyproxy/envoy/merges","archive_url":"https://api.github.com/repos/envoyproxy/envoy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/envoyproxy/envoy/downloads","issues_url":"https://api.github.com/repos/envoyproxy/envoy/issues{/number}","pulls_url":"https://api.github.com/repos/envoyproxy/envoy/pulls{/number}","milestones_url":"https://api.github.com/repos/envoyproxy/envoy/milestones{/number}","notifications_url":"https://api.github.com/repos/envoyproxy/envoy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/envoyproxy/envoy/labels{/name}","releases_url":"https://api.github.com/repos/envoyproxy/envoy/releases{/id}","deployments_url":"https://api.github.com/repos/envoyproxy/envoy/deployments","created_at":"2016-08-08T15:07:24Z","updated_at":"2018-08-14T16:41:04Z","pushed_at":"2018-08-14T16:47:47Z","git_url":"git://github.com/envoyproxy/envoy.git","ssh_url":"git@github.com:envoyproxy/envoy.git","clone_url":"https://github.com/envoyproxy/envoy.git","svn_url":"https://github.com/envoyproxy/envoy","homepage":"https://www.envoyproxy.io","size":18962,"stargazers_count":6194,"watchers_count":6194,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":815,"mirror_url":null,"archived":false,"open_issues_count":325,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":815,"open_issues":325,"watchers":6194,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/4129"},"html":{"href":"https://github.com/envoyproxy/envoy/pull/4129"},"issue":{"href":"https://api.github.com/repos/envoyproxy/envoy/issues/4129"},"comments":{"href":"https://api.github.com/repos/envoyproxy/envoy/issues/4129/comments"},"review_comments":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/4129/comments"},"review_comment":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/envoyproxy/envoy/pulls/4129/commits"},"statuses":{"href":"https://api.github.com/repos/envoyproxy/envoy/statuses/d7d65ad808eeb13c95f6292dc4060f285da0dc9f"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"htuch"}}