From 7555c5d67d4ef3de9b908d10ca25efae86e8e6b6 Mon Sep 17 00:00:00 2001 From: jmestwa-coder Date: Wed, 29 Apr 2026 22:00:32 +0530 Subject: [PATCH] add DCHECK bounds checks to operator[] --- re2/pod_array.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/re2/pod_array.h b/re2/pod_array.h index f234e976f..96429df2c 100644 --- a/re2/pod_array.h +++ b/re2/pod_array.h @@ -8,6 +8,8 @@ #include #include +#include "absl/log/absl_check.h" + namespace re2 { template @@ -30,6 +32,8 @@ class PODArray { } T& operator[](int pos) const { + ABSL_DCHECK_GE(pos, 0); + ABSL_DCHECK_LT(pos, size()); return ptr_[pos]; }