[PATCH] D39260: [asan] Don't print rows of shadow bytes outside shadow memory

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 25 09:54:33 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL316589: [asan] Don't print rows of shadow bytes outside shadow memory (authored by rnk).

Changed prior to commit:
  https://reviews.llvm.org/D39260?vs=120139&id=120275#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D39260

Files:
  compiler-rt/trunk/lib/asan/asan_errors.cc


Index: compiler-rt/trunk/lib/asan/asan_errors.cc
===================================================================
--- compiler-rt/trunk/lib/asan/asan_errors.cc
+++ compiler-rt/trunk/lib/asan/asan_errors.cc
@@ -422,9 +422,14 @@
   InternalScopedString str(4096 * 8);
   str.append("Shadow bytes around the buggy address:\n");
   for (int i = -5; i <= 5; i++) {
+    uptr row_shadow_addr = aligned_shadow + i * n_bytes_per_row;
+    // Skip rows that would be outside the shadow range. This can happen when
+    // the user address is near the bottom, top, or shadow gap of the address
+    // space.
+    if (!AddrIsInShadow(row_shadow_addr)) continue;
     const char *prefix = (i == 0) ? "=>" : "  ";
-    PrintShadowBytes(&str, prefix, (u8 *)(aligned_shadow + i * n_bytes_per_row),
-                     (u8 *)shadow_addr, n_bytes_per_row);
+    PrintShadowBytes(&str, prefix, (u8 *)row_shadow_addr, (u8 *)shadow_addr,
+                     n_bytes_per_row);
   }
   if (flags()->print_legend) PrintLegend(&str);
   Printf("%s", str.data());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39260.120275.patch
Type: text/x-patch
Size: 1047 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171025/39493e42/attachment.bin>


More information about the llvm-commits mailing list