diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:11:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:12:43 +0000 |
commit | cf94bdc0742c13e2a0cac864c478b8626b266e1b (patch) | |
tree | 044670aa50cc5e2b4229aa0b6b3df6676730c0a6 /vendor/miniz_oxide/src/inflate/mod.rs | |
parent | Adding debian version 1.65.0+dfsg1-2. (diff) | |
download | rustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.tar.xz rustc-cf94bdc0742c13e2a0cac864c478b8626b266e1b.zip |
Merging upstream version 1.66.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/miniz_oxide/src/inflate/mod.rs')
-rw-r--r-- | vendor/miniz_oxide/src/inflate/mod.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/vendor/miniz_oxide/src/inflate/mod.rs b/vendor/miniz_oxide/src/inflate/mod.rs index 535392327..03b9dc988 100644 --- a/vendor/miniz_oxide/src/inflate/mod.rs +++ b/vendor/miniz_oxide/src/inflate/mod.rs @@ -151,14 +151,12 @@ fn decompress_to_vec_inner( } TINFLStatus::HasMoreOutput => { - // We need more space, so check if we can resize the buffer and do it. - let new_len = ret - .len() - .checked_add(out_pos) - .ok_or(TINFLStatus::HasMoreOutput)?; - if new_len > max_output_size { + // if the buffer has already reached the size limit, return an error + if ret.len() >= max_output_size { return Err(TINFLStatus::HasMoreOutput); - }; + } + // calculate the new length, capped at `max_output_size` + let new_len = ret.len().saturating_mul(2).min(max_output_size); ret.resize(new_len, 0); } |