[compiler-rt] r364609 - hwasan: Fix an off-by-one error in PrintTagsAroundAddr.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 27 16:24:36 PDT 2019


Author: pcc
Date: Thu Jun 27 16:24:36 2019
New Revision: 364609

URL: http://llvm.org/viewvc/llvm-project?rev=364609&view=rev
Log:
hwasan: Fix an off-by-one error in PrintTagsAroundAddr.

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

Differential Revision: https://reviews.llvm.org/D63906

Modified:
    compiler-rt/trunk/lib/hwasan/hwasan_report.cpp

Modified: compiler-rt/trunk/lib/hwasan/hwasan_report.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/hwasan/hwasan_report.cpp?rev=364609&r1=364608&r2=364609&view=diff
==============================================================================
--- compiler-rt/trunk/lib/hwasan/hwasan_report.cpp (original)
+++ compiler-rt/trunk/lib/hwasan/hwasan_report.cpp Thu Jun 27 16:24:36 2019
@@ -335,7 +335,7 @@ static void PrintTagsAroundAddr(tag_t *t
   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 ? "=>" : "  ");




More information about the llvm-commits mailing list