Firefox · Core
CVE-2026-4690
Integer Overflow in Core
Overview
High
Severity
—
CVSS
No
Exploited ITW
Fixed
Fix Status
Files Changed
xpcom/io/SnappyUncompressInputStream.cpp
Patch
diff --git a/xpcom/io/SnappyUncompressInputStream.cpp b/xpcom/io/SnappyUncompressInputStream.cpp
index 2872c8c7a26..3ab8f794979 100644
--- a/xpcom/io/SnappyUncompressInputStream.cpp
+++ b/xpcom/io/SnappyUncompressInputStream.cpp
@@ -21,7 +21,7 @@ static size_t CompressedBufferLength() {
static size_t kCompressedBufferLength =
detail::SnappyFrameUtils::MaxCompressedBufferLength(snappy::kBlockSize);
- MOZ_ASSERT(kCompressedBufferLength > 0);
+ MOZ_ASSERT(kCompressedBufferLength > detail::SnappyFrameUtils::kHeaderLength);
return kCompressedBufferLength;
}
@@ -287,7 +287,9 @@ nsresult SnappyUncompressInputStream::ParseNextChunk(uint32_t* aBytesReadOut) {
// We have no decompressed data, but we do know the size of the next chunk.
// Read at least that much from the base stream.
uint32_t readLength = mNextChunkDataLength;
- MOZ_ASSERT(readLength <= CompressedBufferLength());
+ if (readLength > CompressedBufferLength() - kHeaderLength) {
+ return NS_ERROR_CORRUPTED_CONTENT;
+ }
// However, if there is enough data in the base stream, also read the next
// chunk header. This helps optimize the stream by avoiding many small reads.
Loading diff…
References
On This Page