summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-01-19 17:01:28 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-01-19 17:01:28 +0000
commitef967505d84a6fdb395d58a698999632b55b86b3 (patch)
tree7efd1dcb6cb590f747048e71132b4f2277ad1560
parent389ade8054b7438e9f4e205e8b88f6900d71d85e (diff)
parent036115db61e03e5b36443dfd8ca2a70c54b0d723 (diff)
downloadzlib-android11-platform-release.tar.gz
Change-Id: I9bdfa11b62a7200d9a5b005da083cc9cda7dc682
-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);