zlib/zlib-1.2.12-fix-CVE-2022-37434.patch
Lukas Javorsky de5caa002f Fix heap-based buffer over-read or buffer overflow in inflate.c
Upstream patch: ec3df00224

Resolves: CVE-2022-37434
2022-08-10 08:13:53 +00:00

15 lines
782 B
Diff

--- zlib-1.2.12/inflate.c.old 2022-08-09 10:30:18.831225181 +0000
+++ zlib-1.2.12/inflate.c 2022-08-09 10:29:33.251225181 +0000
@@ -792,8 +792,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);