[compiler-rt] r288234 - [asan] Avoid redundant poisoning checks in __sanitizer_contiguous_container_find_bad_address.

Maxim Ostapenko via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 30 01:11:48 PST 2016


Author: chefmax
Date: Wed Nov 30 03:11:47 2016
New Revision: 288234

URL: http://llvm.org/viewvc/llvm-project?rev=288234&view=rev
Log:
[asan] Avoid redundant poisoning checks in __sanitizer_contiguous_container_find_bad_address.

__sanitizer_contiguous_container_find_bad_address computes three regions of a
container to check for poisoning: begin, middle, end. The issue is that in current
design the first region can be significantly larger than kMaxRangeToCheck.

Proposed patch fixes a typo to calculate the first region properly.

Patch by Ivan Baravy.

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

Modified:
    compiler-rt/trunk/lib/asan/asan_poisoning.cc

Modified: compiler-rt/trunk/lib/asan/asan_poisoning.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_poisoning.cc?rev=288234&r1=288233&r2=288234&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_poisoning.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_poisoning.cc Wed Nov 30 03:11:47 2016
@@ -412,7 +412,7 @@ const void *__sanitizer_contiguous_conta
   // ending with end.
   uptr kMaxRangeToCheck = 32;
   uptr r1_beg = beg;
-  uptr r1_end = Min(end + kMaxRangeToCheck, mid);
+  uptr r1_end = Min(beg + kMaxRangeToCheck, mid);
   uptr r2_beg = Max(beg, mid - kMaxRangeToCheck);
   uptr r2_end = Min(end, mid + kMaxRangeToCheck);
   uptr r3_beg = Max(end - kMaxRangeToCheck, mid);




More information about the llvm-commits mailing list