Skip to content

Commit 907fc62

Browse files
Merge pull request #167 from Shnatsel/master
Enforce decompressed size limits
2 parents 6c203b9 + a6bbe70 commit 907fc62

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ proc-macro = false
2929
lebe = "^0.5.2" # generic binary serialization
3030
half = "^1.8.2" # 16 bit float pixel data type
3131
bit_field = "^0.10.1" # exr file version bit flags
32-
miniz_oxide = "^0.5.3" # zip compression for pxr24
32+
miniz_oxide = "^0.5.4" # zip compression for pxr24
3333
smallvec = "^1.7.0" # make cache-friendly allocations TODO profile if smallvec is really an improvement!
3434
threadpool = "^1.8.1" # threading for parallel compression TODO make this an optional feature?
3535
flume = "^0.10.9" # crossbeam, but less unsafe code TODO make this an optional feature?

src/compression/pxr24.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ pub fn decompress(channels: &ChannelList, bytes: ByteVec, area: IntegerBounds, e
146146
}
147147

148148
let raw = miniz_oxide::inflate
149-
// TODO ::decompress_to_vec_zlib_with_limit(bytes, expected_byte_size)
150-
::decompress_to_vec_zlib(&bytes)
149+
::decompress_to_vec_zlib_with_limit(&bytes, expected_byte_size)
151150
.map_err(|_| Error::invalid("zlib-compressed data malformed"))?; // TODO share code with zip?
152151

153152
let mut read = raw.as_slice();

src/compression/zip.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ pub fn decompress_bytes(
1616
channels: &ChannelList,
1717
data: ByteVec,
1818
rectangle: IntegerBounds,
19-
_expected_byte_size: usize,
19+
expected_byte_size: usize,
2020
_pedantic: bool,
2121
) -> Result<ByteVec> {
2222
let mut decompressed = miniz_oxide::inflate
23-
// TODO ::decompress_to_vec_zlib_with_limit(data, expected_byte_size)
24-
::decompress_to_vec_zlib(&data)
23+
::decompress_to_vec_zlib_with_limit(&data, expected_byte_size)
2524
.map_err(|_| Error::invalid("zlib-compressed data malformed"))?;
2625

2726
differences_to_samples(&mut decompressed);

0 commit comments

Comments
 (0)