Skip to content

Commit

Permalink
Fix check for too large of uncompressed size
Browse files Browse the repository at this point in the history
  • Loading branch information
kriszyp committed Apr 8, 2024
1 parent 943d381 commit 62ee700
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/compression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ void Compression::decompress(MDB_val& data, bool &isValid, bool canAllocate) {
isValid = false;
return;
}
//fprintf(stdout, "compressed size %u uncompressedLength %u, first byte %u\n", data.mv_size, uncompressedLength + startingOffset, charData[compressionHeaderSize]);
data.mv_data = decompressTarget;
data.mv_size = uncompressedLength + startingOffset;
//TODO: For larger blocks with known encoding, it might make sense to allocate space for it and use an ExternalString
//fprintf(stdout, "compressed size %u uncompressedLength %u, first byte %u\n", data.mv_size, uncompressedLength, charData[compressionHeaderSize]);
if (uncompressedLength > decompressSize) {
if (uncompressedLength + startingOffset > decompressSize) {
isValid = false;
return;
}
Expand Down

0 comments on commit 62ee700

Please sign in to comment.