[ASan] Minor fix: return to the last byte of the fake stack if we've raced by.
authorAlexander Potapenko <glider@google.com>
Thu, 15 Nov 2012 14:59:19 +0000 (14:59 +0000)
committerAlexander Potapenko <glider@google.com>
Thu, 15 Nov 2012 14:59:19 +0000 (14:59 +0000)
llvm-svn: 168043

compiler-rt/lib/asan/asan_thread.cc

index 9ac3962..df764a9 100644 (file)
@@ -143,8 +143,11 @@ const char *AsanThread::GetFrameNameByAddr(uptr addr, uptr *offset) {
   }
 
   if (shadow_ptr < shadow_bottom) {
-    *offset = 0;
-    return "UNKNOWN";
+    // If we're one byte below the fake stack bottom, we've found the frame.
+    if (!is_fake_stack || (*shadow_bottom != kAsanStackAfterReturnLeftMagic)) {
+      *offset = 0;
+      return "UNKNOWN";
+    }
   }
 
   uptr* ptr = (uptr*)SHADOW_TO_MEM((uptr)(shadow_ptr + 1));