mindspore/third_party/patch/zlib/CVE-2022-37434.patch

16 lines
867 B
Diff

diff -Npur zlib-1.2.11/inflate.c zlib-1.2.11-change/inflate.c
--- zlib-1.2.11/inflate.c 2017-01-01 15:37:10.000000000 +0800
+++ zlib-1.2.11-change/inflate.c 2022-08-17 06:25:06.033176873 +0800
@@ -759,8 +759,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);