{"action":"created","issue":{"url":"https://api.github.com/repos/ceph/ceph/issues/7779","repository_url":"https://api.github.com/repos/ceph/ceph","labels_url":"https://api.github.com/repos/ceph/ceph/issues/7779/labels{/name}","comments_url":"https://api.github.com/repos/ceph/ceph/issues/7779/comments","events_url":"https://api.github.com/repos/ceph/ceph/issues/7779/events","html_url":"https://github.com/ceph/ceph/pull/7779","id":136112402,"number":7779,"title":"test/bufferlist: Fixing corruption on ptr(ptr&& p)","user":{"login":"ErwanAliasr1","id":4539421,"avatar_url":"https://avatars.githubusercontent.com/u/4539421?v=3","gravatar_id":"","url":"https://api.github.com/users/ErwanAliasr1","html_url":"https://github.com/ErwanAliasr1","followers_url":"https://api.github.com/users/ErwanAliasr1/followers","following_url":"https://api.github.com/users/ErwanAliasr1/following{/other_user}","gists_url":"https://api.github.com/users/ErwanAliasr1/gists{/gist_id}","starred_url":"https://api.github.com/users/ErwanAliasr1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ErwanAliasr1/subscriptions","organizations_url":"https://api.github.com/users/ErwanAliasr1/orgs","repos_url":"https://api.github.com/users/ErwanAliasr1/repos","events_url":"https://api.github.com/users/ErwanAliasr1/events{/privacy}","received_events_url":"https://api.github.com/users/ErwanAliasr1/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ceph/ceph/labels/bug%20fix","name":"bug fix","color":"e11d21"},{"url":"https://api.github.com/repos/ceph/ceph/labels/needs-qa","name":"needs-qa","color":"fad8c7"},{"url":"https://api.github.com/repos/ceph/ceph/labels/tests","name":"tests","color":"cccccc"}],"state":"closed","locked":false,"assignee":{"login":"dachary","id":433594,"avatar_url":"https://avatars.githubusercontent.com/u/433594?v=3","gravatar_id":"","url":"https://api.github.com/users/dachary","html_url":"https://github.com/dachary","followers_url":"https://api.github.com/users/dachary/followers","following_url":"https://api.github.com/users/dachary/following{/other_user}","gists_url":"https://api.github.com/users/dachary/gists{/gist_id}","starred_url":"https://api.github.com/users/dachary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dachary/subscriptions","organizations_url":"https://api.github.com/users/dachary/orgs","repos_url":"https://api.github.com/users/dachary/repos","events_url":"https://api.github.com/users/dachary/events{/privacy}","received_events_url":"https://api.github.com/users/dachary/received_events","type":"User","site_admin":false},"milestone":null,"comments":11,"created_at":"2016-02-24T16:30:33Z","updated_at":"2016-03-07T12:29:39Z","closed_at":"2016-03-03T14:29:04Z","pull_request":{"url":"https://api.github.com/repos/ceph/ceph/pulls/7779","html_url":"https://github.com/ceph/ceph/pull/7779","diff_url":"https://github.com/ceph/ceph/pull/7779.diff","patch_url":"https://github.com/ceph/ceph/pull/7779.patch"},"body":"The bufferlist is trying to compare two strings by doing :\r\n    str.compare(0, str.size(), ptr.c_str())\r\n\r\nThis have been introduced recently in commit 41c3dc2e734a6f57c3636db5a937edd8f8b66b39.\r\n\r\nThe issue in that test is not providing the amount of char to compare but only\r\nthe size of 'str'.\r\n\r\nAs a result, it does compare a null-terminated string (str) with a\r\nnon-terminated buffer (ptr).\r\n\r\nThe issue was discoverd by having on a test where\r\n - str=\"XXXXXXXXXXXXXXXXX\"\r\nbut\r\n - ptr=\"XXXXXXXXXXXXXXXXXriptor\".\r\n\r\nThe associated assertion failed and broke the test.\r\n\r\nThis patch is fixing the issue by using the memcmp() call as per 'ptr(const\r\nptr& p, unsigned o, unsigned l)' test.\r\n\r\nThe simple solution is to test the buffer at the byte level and only for the\r\nn-bytes of the initial string.\r\n\r\nThat change makes the test passing.\r\n\r\nRegarding the initial code, that's pretty a big chance that no-one hit that\r\nbefore.\r\n\r\nSigned-off-by: Erwan Velu <erwan@redhat.com>"},"comment":{"url":"https://api.github.com/repos/ceph/ceph/issues/comments/193231682","html_url":"https://github.com/ceph/ceph/pull/7779#issuecomment-193231682","issue_url":"https://api.github.com/repos/ceph/ceph/issues/7779","id":193231682,"user":{"login":"ErwanAliasr1","id":4539421,"avatar_url":"https://avatars.githubusercontent.com/u/4539421?v=3","gravatar_id":"","url":"https://api.github.com/users/ErwanAliasr1","html_url":"https://github.com/ErwanAliasr1","followers_url":"https://api.github.com/users/ErwanAliasr1/followers","following_url":"https://api.github.com/users/ErwanAliasr1/following{/other_user}","gists_url":"https://api.github.com/users/ErwanAliasr1/gists{/gist_id}","starred_url":"https://api.github.com/users/ErwanAliasr1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ErwanAliasr1/subscriptions","organizations_url":"https://api.github.com/users/ErwanAliasr1/orgs","repos_url":"https://api.github.com/users/ErwanAliasr1/repos","events_url":"https://api.github.com/users/ErwanAliasr1/events{/privacy}","received_events_url":"https://api.github.com/users/ErwanAliasr1/received_events","type":"User","site_admin":false},"created_at":"2016-03-07T12:29:39Z","updated_at":"2016-03-07T12:29:39Z","body":"I pushed #7955 to explain & solve the issue I see with this way to fix it."}}