[PATCH] D63906: hwasan: Fix an off-by-one error in PrintTagsAroundAddr.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 27 16:22:13 PDT 2019


pcc created this revision.
pcc added a reviewer: eugenis.
Herald added subscribers: Sanitizers, kubamracek.
Herald added projects: Sanitizers, LLVM.

Previously we were printing 16 rows of tags, not 17.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D63906

Files:
  compiler-rt/lib/hwasan/hwasan_report.cpp


Index: compiler-rt/lib/hwasan/hwasan_report.cpp
===================================================================
--- compiler-rt/lib/hwasan/hwasan_report.cpp
+++ compiler-rt/lib/hwasan/hwasan_report.cpp
@@ -289,7 +289,7 @@
   tag_t *center_row_beg = reinterpret_cast<tag_t *>(
       RoundDownTo(reinterpret_cast<uptr>(tag_ptr), row_len));
   tag_t *beg_row = center_row_beg - row_len * (num_rows / 2);
-  tag_t *end_row = center_row_beg + row_len * (num_rows / 2);
+  tag_t *end_row = center_row_beg + row_len * ((num_rows + 1) / 2);
   InternalScopedString s(GetPageSizeCached() * 8);
   for (tag_t *row = beg_row; row < end_row; row += row_len) {
     s.append("%s", row == center_row_beg ? "=>" : "  ");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63906.206961.patch
Type: text/x-patch
Size: 711 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190627/81656277/attachment.bin>


More information about the llvm-commits mailing list