{"action":"created","comment":{"url":"https://api.github.com/repos/influxdb/influxdb/pulls/comments/43298451","id":43298451,"diff_hunk":"@@ -741,6 +741,16 @@ func scanLine(buf []byte, i int) (int, []byte) {\n \tstart := i\n \tquoted := false\n \tfields := false\n+\tbufLength := len(buf)\n+\n+\tfor {\n+\t\tif bufLength > start && buf[start] == 0 {","path":"models/points.go","position":null,"original_position":7,"commit_id":"f13af15e7143195058143158170c952a8163722d","original_commit_id":"81438f56de0e672a426836c71f1982fc37e7d689","user":{"login":"otoolep","id":536312,"avatar_url":"https://avatars.githubusercontent.com/u/536312?v=3","gravatar_id":"","url":"https://api.github.com/users/otoolep","html_url":"https://github.com/otoolep","followers_url":"https://api.github.com/users/otoolep/followers","following_url":"https://api.github.com/users/otoolep/following{/other_user}","gists_url":"https://api.github.com/users/otoolep/gists{/gist_id}","starred_url":"https://api.github.com/users/otoolep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/otoolep/subscriptions","organizations_url":"https://api.github.com/users/otoolep/orgs","repos_url":"https://api.github.com/users/otoolep/repos","events_url":"https://api.github.com/users/otoolep/events{/privacy}","received_events_url":"https://api.github.com/users/otoolep/received_events","type":"User","site_admin":false},"body":"Yeah, that is fair enough.\n\nOn Wed, Oct 28, 2015 at 11:14 AM, Lim Chee Hau <notifications@github.com>\nwrote:\n\n> In models/points.go\n> <https://github.com/influxdb/influxdb/pull/4596#discussion_r43296011>:\n>\n> > @@ -741,6 +741,16 @@ func scanLine(buf []byte, i int) (int, []byte) {\n> >  \tstart := i\n> >  \tquoted := false\n> >  \tfields := false\n> > +\tbufLength := len(buf)\n> > +\n> > +\tfor {\n> > +\t\tif bufLength > start && buf[start] == 0 {\n>\n> I think it is possible if someone purposely do it programmatically.\n>\n> This fixes is more like a prevention for a programmer's mistake, eg,\n> buffer helps us to generate empty string without we knowing it, and it is\n> not visible until the result from len(key).is called.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/influxdb/influxdb/pull/4596/files#r43296011>.\n>\n","created_at":"2015-10-28T18:31:26Z","updated_at":"2015-10-28T18:31:26Z","html_url":"https://github.com/influxdb/influxdb/pull/4596#discussion_r43298451","pull_request_url":"https://api.github.com/repos/influxdb/influxdb/pulls/4596","_links":{"self":{"href":"https://api.github.com/repos/influxdb/influxdb/pulls/comments/43298451"},"html":{"href":"https://github.com/influxdb/influxdb/pull/4596#discussion_r43298451"},"pull_request":{"href":"https://api.github.com/repos/influxdb/influxdb/pulls/4596"}}},"pull_request":{"url":"https://api.github.com/repos/influxdb/influxdb/pulls/4596","id":49015468,"html_url":"https://github.com/influxdb/influxdb/pull/4596","diff_url":"https://github.com/influxdb/influxdb/pull/4596.diff","patch_url":"https://github.com/influxdb/influxdb/pull/4596.patch","issue_url":"https://api.github.com/repos/influxdb/influxdb/issues/4596","number":4596,"state":"open","locked":false,"title":"skip empty string for start position","user":{"login":"ch33hau","id":1395262,"avatar_url":"https://avatars.githubusercontent.com/u/1395262?v=3","gravatar_id":"","url":"https://api.github.com/users/ch33hau","html_url":"https://github.com/ch33hau","followers_url":"https://api.github.com/users/ch33hau/followers","following_url":"https://api.github.com/users/ch33hau/following{/other_user}","gists_url":"https://api.github.com/users/ch33hau/gists{/gist_id}","starred_url":"https://api.github.com/users/ch33hau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ch33hau/subscriptions","organizations_url":"https://api.github.com/users/ch33hau/orgs","repos_url":"https://api.github.com/users/ch33hau/repos","events_url":"https://api.github.com/users/ch33hau/events{/privacy}","received_events_url":"https://api.github.com/users/ch33hau/received_events","type":"User","site_admin":false},"body":"Hi,\r\n\r\nI found out that **scanLine()** in **models/points.go** doesn't filter empty string (uint8 = 0) for **start** position.\r\nThis will introduce some weird issues if the input is made from a large buffer, the Key() from first point gonna be a very large string with all the empty string due to the invalid start position.\r\n\r\nOne of the obvious example is, if you change the value from **uswest10** to **uswest1** in https://github.com/influxdb/influxdb/blob/master/tsdb/engine/wal/wal_test.go#L327, the test will be failed due to this issue (only uswest1 will fail, uswest2 until uswest100 working fine). The reason is the **first key** is a large string **(350000*uint8 + \"cpu,host=A,region=uswest1\")**, it return no result when we pass in the valid key **\"cpu,host=A,region=uswest1\"** to lookup value from map (string comparison failed).\r\n* uswest10 (or uswest2 until uswest99) have no issue is because it is not the first point.\r\n\r\nI have also created a test for points_test.go, this test gonna be failed without the new changes.\r\n\r\nSorry if my explanation is not clear enough. ","created_at":"2015-10-28T14:45:14Z","updated_at":"2015-10-28T18:31:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"813ecd31035e00d5276be5d9003703d91a01950b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/influxdb/influxdb/pulls/4596/commits","review_comments_url":"https://api.github.com/repos/influxdb/influxdb/pulls/4596/comments","review_comment_url":"https://api.github.com/repos/influxdb/influxdb/pulls/comments{/number}","comments_url":"https://api.github.com/repos/influxdb/influxdb/issues/4596/comments","statuses_url":"https://api.github.com/repos/influxdb/influxdb/statuses/f13af15e7143195058143158170c952a8163722d","head":{"label":"ch33hau:models_point_skip_empty_string","ref":"models_point_skip_empty_string","sha":"f13af15e7143195058143158170c952a8163722d","user":{"login":"ch33hau","id":1395262,"avatar_url":"https://avatars.githubusercontent.com/u/1395262?v=3","gravatar_id":"","url":"https://api.github.com/users/ch33hau","html_url":"https://github.com/ch33hau","followers_url":"https://api.github.com/users/ch33hau/followers","following_url":"https://api.github.com/users/ch33hau/following{/other_user}","gists_url":"https://api.github.com/users/ch33hau/gists{/gist_id}","starred_url":"https://api.github.com/users/ch33hau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ch33hau/subscriptions","organizations_url":"https://api.github.com/users/ch33hau/orgs","repos_url":"https://api.github.com/users/ch33hau/repos","events_url":"https://api.github.com/users/ch33hau/events{/privacy}","received_events_url":"https://api.github.com/users/ch33hau/received_events","type":"User","site_admin":false},"repo":{"id":44898891,"name":"influxdb","full_name":"ch33hau/influxdb","owner":{"login":"ch33hau","id":1395262,"avatar_url":"https://avatars.githubusercontent.com/u/1395262?v=3","gravatar_id":"","url":"https://api.github.com/users/ch33hau","html_url":"https://github.com/ch33hau","followers_url":"https://api.github.com/users/ch33hau/followers","following_url":"https://api.github.com/users/ch33hau/following{/other_user}","gists_url":"https://api.github.com/users/ch33hau/gists{/gist_id}","starred_url":"https://api.github.com/users/ch33hau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ch33hau/subscriptions","organizations_url":"https://api.github.com/users/ch33hau/orgs","repos_url":"https://api.github.com/users/ch33hau/repos","events_url":"https://api.github.com/users/ch33hau/events{/privacy}","received_events_url":"https://api.github.com/users/ch33hau/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ch33hau/influxdb","description":"Scalable datastore for metrics, events, and real-time analytics","fork":true,"url":"https://api.github.com/repos/ch33hau/influxdb","forks_url":"https://api.github.com/repos/ch33hau/influxdb/forks","keys_url":"https://api.github.com/repos/ch33hau/influxdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ch33hau/influxdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ch33hau/influxdb/teams","hooks_url":"https://api.github.com/repos/ch33hau/influxdb/hooks","issue_events_url":"https://api.github.com/repos/ch33hau/influxdb/issues/events{/number}","events_url":"https://api.github.com/repos/ch33hau/influxdb/events","assignees_url":"https://api.github.com/repos/ch33hau/influxdb/assignees{/user}","branches_url":"https://api.github.com/repos/ch33hau/influxdb/branches{/branch}","tags_url":"https://api.github.com/repos/ch33hau/influxdb/tags","blobs_url":"https://api.github.com/repos/ch33hau/influxdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ch33hau/influxdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ch33hau/influxdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/ch33hau/influxdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ch33hau/influxdb/statuses/{sha}","languages_url":"https://api.github.com/repos/ch33hau/influxdb/languages","stargazers_url":"https://api.github.com/repos/ch33hau/influxdb/stargazers","contributors_url":"https://api.github.com/repos/ch33hau/influxdb/contributors","subscribers_url":"https://api.github.com/repos/ch33hau/influxdb/subscribers","subscription_url":"https://api.github.com/repos/ch33hau/influxdb/subscription","commits_url":"https://api.github.com/repos/ch33hau/influxdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/ch33hau/influxdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/ch33hau/influxdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/ch33hau/influxdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/ch33hau/influxdb/contents/{+path}","compare_url":"https://api.github.com/repos/ch33hau/influxdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ch33hau/influxdb/merges","archive_url":"https://api.github.com/repos/ch33hau/influxdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ch33hau/influxdb/downloads","issues_url":"https://api.github.com/repos/ch33hau/influxdb/issues{/number}","pulls_url":"https://api.github.com/repos/ch33hau/influxdb/pulls{/number}","milestones_url":"https://api.github.com/repos/ch33hau/influxdb/milestones{/number}","notifications_url":"https://api.github.com/repos/ch33hau/influxdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ch33hau/influxdb/labels{/name}","releases_url":"https://api.github.com/repos/ch33hau/influxdb/releases{/id}","created_at":"2015-10-25T06:17:34Z","updated_at":"2015-10-25T06:17:39Z","pushed_at":"2015-10-28T18:29:03Z","git_url":"git://github.com/ch33hau/influxdb.git","ssh_url":"git@github.com:ch33hau/influxdb.git","clone_url":"https://github.com/ch33hau/influxdb.git","svn_url":"https://github.com/ch33hau/influxdb","homepage":"http://influxdb.com","size":32904,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"influxdb:master","ref":"master","sha":"bb8ee65261a32a7be7ec346ce47f7da14d216db5","user":{"login":"influxdb","id":5713248,"avatar_url":"https://avatars.githubusercontent.com/u/5713248?v=3","gravatar_id":"","url":"https://api.github.com/users/influxdb","html_url":"https://github.com/influxdb","followers_url":"https://api.github.com/users/influxdb/followers","following_url":"https://api.github.com/users/influxdb/following{/other_user}","gists_url":"https://api.github.com/users/influxdb/gists{/gist_id}","starred_url":"https://api.github.com/users/influxdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/influxdb/subscriptions","organizations_url":"https://api.github.com/users/influxdb/orgs","repos_url":"https://api.github.com/users/influxdb/repos","events_url":"https://api.github.com/users/influxdb/events{/privacy}","received_events_url":"https://api.github.com/users/influxdb/received_events","type":"Organization","site_admin":false},"repo":{"id":13124802,"name":"influxdb","full_name":"influxdb/influxdb","owner":{"login":"influxdb","id":5713248,"avatar_url":"https://avatars.githubusercontent.com/u/5713248?v=3","gravatar_id":"","url":"https://api.github.com/users/influxdb","html_url":"https://github.com/influxdb","followers_url":"https://api.github.com/users/influxdb/followers","following_url":"https://api.github.com/users/influxdb/following{/other_user}","gists_url":"https://api.github.com/users/influxdb/gists{/gist_id}","starred_url":"https://api.github.com/users/influxdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/influxdb/subscriptions","organizations_url":"https://api.github.com/users/influxdb/orgs","repos_url":"https://api.github.com/users/influxdb/repos","events_url":"https://api.github.com/users/influxdb/events{/privacy}","received_events_url":"https://api.github.com/users/influxdb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/influxdb/influxdb","description":"Scalable datastore for metrics, events, and real-time analytics","fork":false,"url":"https://api.github.com/repos/influxdb/influxdb","forks_url":"https://api.github.com/repos/influxdb/influxdb/forks","keys_url":"https://api.github.com/repos/influxdb/influxdb/keys{/key_id}","collaborators_url":"https://api.github.com/repos/influxdb/influxdb/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/influxdb/influxdb/teams","hooks_url":"https://api.github.com/repos/influxdb/influxdb/hooks","issue_events_url":"https://api.github.com/repos/influxdb/influxdb/issues/events{/number}","events_url":"https://api.github.com/repos/influxdb/influxdb/events","assignees_url":"https://api.github.com/repos/influxdb/influxdb/assignees{/user}","branches_url":"https://api.github.com/repos/influxdb/influxdb/branches{/branch}","tags_url":"https://api.github.com/repos/influxdb/influxdb/tags","blobs_url":"https://api.github.com/repos/influxdb/influxdb/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/influxdb/influxdb/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/influxdb/influxdb/git/refs{/sha}","trees_url":"https://api.github.com/repos/influxdb/influxdb/git/trees{/sha}","statuses_url":"https://api.github.com/repos/influxdb/influxdb/statuses/{sha}","languages_url":"https://api.github.com/repos/influxdb/influxdb/languages","stargazers_url":"https://api.github.com/repos/influxdb/influxdb/stargazers","contributors_url":"https://api.github.com/repos/influxdb/influxdb/contributors","subscribers_url":"https://api.github.com/repos/influxdb/influxdb/subscribers","subscription_url":"https://api.github.com/repos/influxdb/influxdb/subscription","commits_url":"https://api.github.com/repos/influxdb/influxdb/commits{/sha}","git_commits_url":"https://api.github.com/repos/influxdb/influxdb/git/commits{/sha}","comments_url":"https://api.github.com/repos/influxdb/influxdb/comments{/number}","issue_comment_url":"https://api.github.com/repos/influxdb/influxdb/issues/comments{/number}","contents_url":"https://api.github.com/repos/influxdb/influxdb/contents/{+path}","compare_url":"https://api.github.com/repos/influxdb/influxdb/compare/{base}...{head}","merges_url":"https://api.github.com/repos/influxdb/influxdb/merges","archive_url":"https://api.github.com/repos/influxdb/influxdb/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/influxdb/influxdb/downloads","issues_url":"https://api.github.com/repos/influxdb/influxdb/issues{/number}","pulls_url":"https://api.github.com/repos/influxdb/influxdb/pulls{/number}","milestones_url":"https://api.github.com/repos/influxdb/influxdb/milestones{/number}","notifications_url":"https://api.github.com/repos/influxdb/influxdb/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/influxdb/influxdb/labels{/name}","releases_url":"https://api.github.com/repos/influxdb/influxdb/releases{/id}","created_at":"2013-09-26T14:31:10Z","updated_at":"2015-10-28T16:39:37Z","pushed_at":"2015-10-28T18:29:04Z","git_url":"git://github.com/influxdb/influxdb.git","ssh_url":"git@github.com:influxdb/influxdb.git","clone_url":"https://github.com/influxdb/influxdb.git","svn_url":"https://github.com/influxdb/influxdb","homepage":"http://influxdb.com","size":63685,"stargazers_count":6592,"watchers_count":6592,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":753,"mirror_url":null,"open_issues_count":397,"forks":753,"open_issues":397,"watchers":6592,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/influxdb/influxdb/pulls/4596"},"html":{"href":"https://github.com/influxdb/influxdb/pull/4596"},"issue":{"href":"https://api.github.com/repos/influxdb/influxdb/issues/4596"},"comments":{"href":"https://api.github.com/repos/influxdb/influxdb/issues/4596/comments"},"review_comments":{"href":"https://api.github.com/repos/influxdb/influxdb/pulls/4596/comments"},"review_comment":{"href":"https://api.github.com/repos/influxdb/influxdb/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/influxdb/influxdb/pulls/4596/commits"},"statuses":{"href":"https://api.github.com/repos/influxdb/influxdb/statuses/f13af15e7143195058143158170c952a8163722d"}}}}