commit | 5f7d66929fb66869d96dfcbacf0d8a586b33766d | [log] [tgz] |
---|---|---|
author | Peter Collingbourne <peter@pcc.me.uk> | Thu Sep 11 18:24:44 2025 -0700 |
committer | GitHub <noreply@github.com> | Fri Sep 12 04:24:44 2025 +0300 |
tree | ebf50d6eddc9f2cd1a46a45975729f2161e51f10 | |
parent | 161441541184b185e7f77e5d78110bf4d89e86e8 [diff] |
Add initializer for statistics field (#2038) Copying uninitialized pointers is undefined behavior, and security mitigations such as structure protection [1] take advantage of this. Previously benchmarks would crash when copying the uninitialized statistics field; fix the crash by initializing it. [1] https://discourse.llvm.org/t/rfc-structure-protection-a-family-of-uaf-mitigation-techniques/85555
diff --git a/include/benchmark/benchmark.h b/include/benchmark/benchmark.h index f88f648..3d83a4d 100644 --- a/include/benchmark/benchmark.h +++ b/include/benchmark/benchmark.h
@@ -1821,6 +1821,7 @@ complexity(oNone), complexity_lambda(), complexity_n(0), + statistics(), report_big_o(false), report_rms(false), allocs_per_iter(0.0) {}