summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-01-04 08:33:48 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-01-04 08:33:48 +0000
commitd5cd4b0221676f3e5a0df3fe109ecf0c5d23e75c (patch)
treec57c88c77fbc80b596ee8b71adf1bdb8a6ea1616
parentcf044acc897bdac14297b81f199e965bd8cd9f20 (diff)
parent88f50571216045a068bf28447b069364dada782c (diff)
downloadzlib-android13-mainline-wifi-release.tar.gz
Snap for 9453251 from 88f50571216045a068bf28447b069364dada782c to mainline-wifi-releaseaml_wif_331910020aml_wif_331810010aml_wif_331710030aml_wif_331613000aml_wif_331511020android13-mainline-wifi-release
Change-Id: Ib991b8e5b4c440cf37871b6e222bb8f096cab27b
-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);