folly/GroupVarint: fix a clang-caught heap-buffer-overrun
authorJim Meyering <meyering@fb.com>
Thu, 25 Sep 2014 22:25:36 +0000 (15:25 -0700)
committerAnton Likhtarov <alikhtarov@fb.com>
Fri, 26 Sep 2014 22:28:11 +0000 (15:28 -0700)
commit054506216d4e0e726bc17bf98a932ef2912690e9
tree28b661122b6265ecc1b0e9e970b7a723733e2eaa
parent61386620a957a4cb58457146be182c4702b4027b
folly/GroupVarint: fix a clang-caught heap-buffer-overrun

Summary:
Avoid a clang-caught heap-buffer-overrun
and document that the ssse3 decoder requires at least 17 bytes
of readable memory starting at the source pointer.
* folly/GroupVarint.h (decode_simple): Comment out dead code.
(decode)[__SSSE3__]: Add a comment describing this limitation.
* folly/test/GroupVarintTest.cpp (testGroupVarint32):
Include <algorithm> for use of std::max.
Ensure that the buffer we use has length at least 17.

Test Plan:
Now, all tests succeed with clang/asan

Reviewed By: simpkins@fb.com

Subscribers: trunkagent, mathieubaudet, njormrod

FB internal diff: D1579109

Tasks: 5241437
folly/GroupVarint.h
folly/test/GroupVarintTest.cpp