summaryrefslogtreecommitdiffstats
path: root/vendor/miniz_oxide/src/inflate/mod.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:11:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:13:23 +0000
commit20431706a863f92cb37dc512fef6e48d192aaf2c (patch)
tree2867f13f5fd5437ba628c67d7f87309ccadcd286 /vendor/miniz_oxide/src/inflate/mod.rs
parentReleasing progress-linux version 1.65.0+dfsg1-2~progress7.99u1. (diff)
downloadrustc-20431706a863f92cb37dc512fef6e48d192aaf2c.tar.xz
rustc-20431706a863f92cb37dc512fef6e48d192aaf2c.zip
Merging upstream version 1.66.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--vendor/miniz_oxide/src/inflate/mod.rs12
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);
}