adenilson / rpms / zlib

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