adenilson / rpms / zlib

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