diff options
Diffstat (limited to 'absl/strings/substitute.cc')
-rw-r--r-- | absl/strings/substitute.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/absl/strings/substitute.cc b/absl/strings/substitute.cc index dd32c75f..a71f565a 100644 --- a/absl/strings/substitute.cc +++ b/absl/strings/substitute.cc @@ -18,6 +18,7 @@ #include <cassert> #include <cstddef> #include <cstdint> +#include <limits> #include <string> #include "absl/base/config.h" @@ -84,6 +85,9 @@ void SubstituteAndAppendArray( // Build the string. size_t original_size = output->size(); + ABSL_INTERNAL_CHECK( + size <= std::numeric_limits<size_t>::max() - original_size, + "size_t overflow"); strings_internal::STLStringResizeUninitializedAmortized(output, original_size + size); char* target = &(*output)[original_size]; |