adenilson / rpms / zlib

Forked from rpms/zlib 8 months ago
Clone
a544b0
From 1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d Mon Sep 17 00:00:00 2001
a544b0
From: Mark Adler <fork@madler.net>
a544b0
Date: Mon, 8 Aug 2022 10:50:09 -0700
a544b0
Subject: [PATCH] Fix extra field processing bug that dereferences NULL
a544b0
 state->head.
a544b0
a544b0
The recent commit to fix a gzip header extra field processing bug
a544b0
introduced the new bug fixed here.
a544b0
---
a544b0
 inflate.c | 4 ++--
a544b0
 1 file changed, 2 insertions(+), 2 deletions(-)
a544b0
a544b0
diff --git a/inflate.c b/inflate.c
a544b0
index 7a72897..2a3c4fe 100644
a544b0
--- a/inflate.c
a544b0
+++ b/inflate.c
a544b0
@@ -763,10 +763,10 @@ int flush;
a544b0
                 copy = state->length;
a544b0
                 if (copy > have) copy = have;
a544b0
                 if (copy) {
a544b0
-                    len = state->head->extra_len - state->length;
a544b0
                     if (state->head != Z_NULL &&
a544b0
                         state->head->extra != Z_NULL &&
a544b0
-                        len < state->head->extra_max) {
a544b0
+                        (len = state->head->extra_len - state->length) <
a544b0
+                            state->head->extra_max) {
a544b0
                         zmemcpy(state->head->extra + len, next,
a544b0
                                 len + copy > state->head->extra_max ?
a544b0
                                 state->head->extra_max - len : copy);
a544b0
-- 
a544b0
2.35.3
a544b0