mirror of
https://github.com/roytam1/basilisk55.git
synced 2026-05-26 15:02:46 +00:00
import from UXP: [XPCOM] Add more validation to SnappyUncompressInputStream (d323fc30)
This commit is contained in:
@@ -23,7 +23,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;
|
||||
}
|
||||
|
||||
@@ -270,6 +270,9 @@ SnappyUncompressInputStream::ParseNextChunk(uint32_t* aBytesReadOut)
|
||||
// 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.
|
||||
|
||||
Reference in New Issue
Block a user