[asan] fix the error message for 16-byte accesses (it previously printed 'unknown-crash')
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@146075 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/asan/asan_rtl.cc b/lib/asan/asan_rtl.cc
index 4fe840d..8216cc6 100644
--- a/lib/asan/asan_rtl.cc
+++ b/lib/asan/asan_rtl.cc
@@ -556,12 +556,13 @@
const char *bug_descr = "unknown-crash";
if (AddrIsInMem(addr)) {
uint8_t *shadow_addr = (uint8_t*)MemToShadow(addr);
- uint8_t shadow_byte = shadow_addr[0];
- if (shadow_byte > 0 && shadow_byte < 128) {
- // we are in the partial right redzone, look at the next shadow byte.
- shadow_byte = shadow_addr[1];
- }
- switch (shadow_byte) {
+ // If we are accessing 16 bytes, look at the second shadow byte.
+ if (*shadow_addr == 0 && access_size > SHADOW_GRANULARITY)
+ shadow_addr++;
+ // If we are in the partial right redzone, look at the next shadow byte.
+ if (*shadow_addr > 0 && *shadow_addr < 128)
+ shadow_addr++;
+ switch (*shadow_addr) {
case kAsanHeapLeftRedzoneMagic:
case kAsanHeapRightRedzoneMagic:
bug_descr = "heap-buffer-overflow";