From: Nathan Moinvaziri Date: Sat, 9 Apr 2022 14:22:01 +0000 (-0700) Subject: Fixed off-by-one error when benchmarking compare256 resulting in heap-buffer-overflow. X-Git-Tag: 2.1.0-beta1~275 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1dce534adb2ba7f136ebe89ad405fa4fd465702e;p=thirdparty%2Fzlib-ng.git Fixed off-by-one error when benchmarking compare256 resulting in heap-buffer-overflow. --- diff --git a/test/benchmarks/benchmark_compare256.cc b/test/benchmarks/benchmark_compare256.cc index e690e8ef..cc1ee5c1 100644 --- a/test/benchmarks/benchmark_compare256.cc +++ b/test/benchmarks/benchmark_compare256.cc @@ -32,7 +32,7 @@ public: } void Bench(benchmark::State& state, compare256_func compare256) { - int32_t match_len = (int32_t)state.range(0); + int32_t match_len = (int32_t)state.range(0) - 1; uint32_t len; str2[match_len] = 0;