X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/38fbf2fd31f5cd99b500914d6037b1d06b608645..0f5d89e82340278ed3d7d50029f37cab2c41a57e:/icuSources/common/bytestream.cpp diff --git a/icuSources/common/bytestream.cpp b/icuSources/common/bytestream.cpp index bfd7bded..0d0e4dda 100644 --- a/icuSources/common/bytestream.cpp +++ b/icuSources/common/bytestream.cpp @@ -45,6 +45,12 @@ void CheckedArrayByteSink::Append(const char* bytes, int32_t n) { if (n <= 0) { return; } + if (n > (INT32_MAX - appended_)) { + // TODO: Report as integer overflow, not merely buffer overflow. + appended_ = INT32_MAX; + overflowed_ = TRUE; + return; + } appended_ += n; int32_t available = capacity_ - size_; if (n > available) {