[compiler-rt] r292955 - Fix pc_array bounds check to use elements instead of bytes
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 24 09:45:35 PST 2017
Author: rnk
Date: Tue Jan 24 11:45:35 2017
New Revision: 292955
URL: http://llvm.org/viewvc/llvm-project?rev=292955&view=rev
Log:
Fix pc_array bounds check to use elements instead of bytes
pc_array_size and kPcArrayMaxSize appear to be measured in elements, not
bytes, so we shouldn't multiply idx by sizeof(uptr) in this bounds
check. 32-bit Chrome was tripping this assertion because it has 64
million coverage points. I don't think it's worth adding a test that has
that many coverage points.
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc?rev=292955&r1=292954&r2=292955&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_coverage_libcdep.cc Tue Jan 24 11:45:35 2017
@@ -415,8 +415,7 @@ void CoverageData::Add(uptr pc, u32 *gua
uptr idx = -guard_value - 1;
if (idx >= atomic_load(&pc_array_index, memory_order_acquire))
return; // May happen after fork when pc_array_index becomes 0.
- CHECK_LT(idx * sizeof(uptr),
- atomic_load(&pc_array_size, memory_order_acquire));
+ CHECK_LT(idx, atomic_load(&pc_array_size, memory_order_acquire));
uptr counter = atomic_fetch_add(&coverage_counter, 1, memory_order_relaxed);
pc_array[idx] = BundlePcAndCounter(pc, counter);
}
More information about the llvm-commits
mailing list