[libcxx-commits] [libcxx] 907a809 - [libc++] Fix out-of-bounds read in the associative container query benchmarks (#227070)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Sep 29 08:01:36 PDT 2026
Author: Louis Dionne
Date: 2026-09-29T15:01:27Z
New Revision: 907a8095efa25c68ee6c3354830f9c632518dd69
URL: https://github.com/llvm/llvm-project/commit/907a8095efa25c68ee6c3354830f9c632518dd69
DIFF: https://github.com/llvm/llvm-project/commit/907a8095efa25c68ee6c3354830f9c632518dd69.diff
LOG: [libc++] Fix out-of-bounds read in the associative container query benchmarks (#227070)
The query benchmarks for associative containers would access the pool of
keys to use in the benchmark out-of-bounds.
Added:
Modified:
libcxx/test/benchmarks/containers/associative/associative_container_benchmarks.h
Removed:
################################################################################
diff --git a/libcxx/test/benchmarks/containers/associative/associative_container_benchmarks.h b/libcxx/test/benchmarks/containers/associative/associative_container_benchmarks.h
index 52d857b08811b..dffc5eb55b37d 100644
--- a/libcxx/test/benchmarks/containers/associative/associative_container_benchmarks.h
+++ b/libcxx/test/benchmarks/containers/associative/associative_container_benchmarks.h
@@ -726,7 +726,7 @@ void associative_container_benchmarks(std::string container) {
for (auto _ : st) {
Key const& key = keys[draws[i]];
auto result = func(c, key);
- i = (i == N_DRAWS ? 0 : i + 1);
+ i = (i + 1 == N_DRAWS ? 0 : i + 1);
benchmark::DoNotOptimize(c);
benchmark::DoNotOptimize(result);
benchmark::ClobberMemory();
More information about the libcxx-commits
mailing list