folly: ASAN-exempt scanHaystackBlock, to avoid an FP buffer overrun
authorJim Meyering <meyering@fb.com>
Fri, 7 Feb 2014 05:01:36 +0000 (21:01 -0800)
committerSara Golemon <sgolemon@fb.com>
Fri, 7 Feb 2014 18:20:25 +0000 (10:20 -0800)
commit219c6976c4a36e5f3675485c2ed90ba891127a49
tree40f5f6f9b42c00514dc6e9f314c1627d68ba69d5
parent7224b63e71e383e8ae78d2e118fbb0a13864eaee
folly: ASAN-exempt scanHaystackBlock, to avoid an FP buffer overrun

Summary:
scanHaystackBlock may read-overrun the needle.data() buffer by
up to 15 bytes, but that overrun will never cross a page boundary.
The fix is to turn off ASAN-checking for this function, but since
that attribute is accompanied by a "noinline" one (which conflicts
with the function's own "inline"), I have also removed the "inline"
attribute on both decl and defn.  That is a good thing, regardless:
these days, there are very few cases in which we should be trying to
tell the compiler to inline.

Test Plan:
Before, this would elicit an ASAN abort.  Now it passes 100%:

fbconfig --platform-all=gcc-4.8.1-glibc-2.17 --sanitize=address \
folly/test:range_test && fbmake runtests

Reviewed By: philipp@fb.com

FB internal diff: D1162982
folly/Range.cpp