summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-02-12 17:01:25 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-02-12 17:01:25 +0000
commit35cedb0a58029bfbd9eeeeacb9a8473ff2876357 (patch)
treec57c88c77fbc80b596ee8b71adf1bdb8a6ea1616
parentdc18fc32e1d3b35b578f1691a6ff92e40c82564b (diff)
parent96bbe1be3610ee5a8599560e605ff5ed4f70a45c (diff)
downloadzlib-android13-d4-s1-release.tar.gz
Merge cherrypicks of ['googleplex-android-review.googlesource.com/20545900'] into tm-d4-release.android-13.0.0_r48android-13.0.0_r47android-13.0.0_r46android13-d4-s2-releaseandroid13-d4-s1-releaseandroid13-d4-release
Change-Id: I86cd7a7d5713fd18805fea95b5e7bee883f74d6e
-rw-r--r--contrib/optimizations/inflate.c5
-rw-r--r--inflate.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/contrib/optimizations/inflate.c b/contrib/optimizations/inflate.c
index 81d558b..93776ac 100644
--- a/contrib/optimizations/inflate.c
+++ b/contrib/optimizations/inflate.c
@@ -771,8 +771,9 @@ int flush;
if (copy > have) copy = have;
if (copy) {
if (state->head != Z_NULL &&
- state->head->extra != Z_NULL) {
- len = state->head->extra_len - state->length;
+ state->head->extra != Z_NULL &&
+ (len = state->head->extra_len - state->length) <
+ state->head->extra_max) {
zmemcpy(state->head->extra + len, next,
len + copy > state->head->extra_max ?
state->head->extra_max - len : copy);
diff --git a/inflate.c b/inflate.c
index 68902e8..9057a57 100644
--- a/inflate.c
+++ b/inflate.c
@@ -760,8 +760,9 @@ int flush;
if (copy > have) copy = have;
if (copy) {
if (state->head != Z_NULL &&
- state->head->extra != Z_NULL) {
- len = state->head->extra_len - state->length;
+ state->head->extra != Z_NULL &&
+ (len = state->head->extra_len - state->length) <
+ state->head->extra_max) {
zmemcpy(state->head->extra + len, next,
len + copy > state->head->extra_max ?
state->head->extra_max - len : copy);