[asan] fix a bug in outlined asan checks and in the corresponding test (ouch)

llvm-svn: 206470
This commit is contained in:
Kostya Serebryany 2014-04-17 14:38:25 +00:00
parent 94ba368946
commit 664b1e2f9b
2 changed files with 3 additions and 2 deletions

View File

@ -383,7 +383,7 @@ ASAN_REPORT_ERROR_N(store, true)
: *reinterpret_cast<u16 *>(sp); \
if (s) { \
if (size >= SHADOW_GRANULARITY || \
(((addr & (SHADOW_GRANULARITY - 1)) + size - 1)) >= s) { \
((s8)((addr & (SHADOW_GRANULARITY - 1)) + size - 1)) >= (s8)s) { \
if (__asan_test_only_reported_buggy_pointer) { \
*__asan_test_only_reported_buggy_pointer = addr; \
} else { \

View File

@ -231,6 +231,7 @@ TEST(AddressSanitizer, LoadStoreCallbacks) {
};
uptr buggy_ptr;
__asan_test_only_reported_buggy_pointer = &buggy_ptr;
for (uptr len = 16; len <= 32; len++) {
char *ptr = new char[len];
@ -240,7 +241,7 @@ TEST(AddressSanitizer, LoadStoreCallbacks) {
uptr size = 1 << size_log;
CB call = cb[is_write][size_log];
// Iterate only size-aligned offsets.
for (uptr offset = 0; offset < len; offset += size) {
for (uptr offset = 0; offset <= len; offset += size) {
buggy_ptr = 0;
call(p + offset);
if (offset + size <= len)