summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-01-10 00:20:00 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-01-10 00:20:00 +0000
commit31f89f2cca2443fa5348e0de0d45aa475f0eaeea (patch)
treec57c88c77fbc80b596ee8b71adf1bdb8a6ea1616
parentdc18fc32e1d3b35b578f1691a6ff92e40c82564b (diff)
parent86c2597ac4478ef7b3794cdeb068afdc2be27d41 (diff)
downloadzlib-android13-qpr3-s12-release.tar.gz
Change-Id: Iefb64bf97d7b0b0249bc6fa8e1e6cad5f33b2516
-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);