]> git.pld-linux.org Git - packages/zlib.git/blame - CVE-2022-37434.patch
Release 5 (by relup.sh)
[packages/zlib.git] / CVE-2022-37434.patch
CommitLineData
39d59a8f
JP
1From eff308af425b67093bab25f80f1ae950166bece1 Mon Sep 17 00:00:00 2001
2From: Mark Adler <fork@madler.net>
3Date: Sat, 30 Jul 2022 15:51:11 -0700
4Subject: [PATCH] Fix a bug when getting a gzip header extra field with
5 inflate().
6
7If the extra field was larger than the space the user provided with
8inflateGetHeader(), and if multiple calls of inflate() delivered
9the extra header data, then there could be a buffer overflow of the
10provided space. This commit assures that provided space is not
11exceeded.
12---
13 inflate.c | 5 +++--
14 1 file changed, 3 insertions(+), 2 deletions(-)
15
16diff --git a/inflate.c b/inflate.c
17index 7be8c6366..7a7289749 100644
18--- a/inflate.c
19+++ b/inflate.c
20@@ -763,9 +763,10 @@ int flush;
21 copy = state->length;
22 if (copy > have) copy = have;
23 if (copy) {
24+ len = state->head->extra_len - state->length;
25 if (state->head != Z_NULL &&
26- state->head->extra != Z_NULL) {
27- len = state->head->extra_len - state->length;
28+ state->head->extra != Z_NULL &&
29+ len < state->head->extra_max) {
30 zmemcpy(state->head->extra + len, next,
31 len + copy > state->head->extra_max ?
32 state->head->extra_max - len : copy);
33From 1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d Mon Sep 17 00:00:00 2001
34From: Mark Adler <fork@madler.net>
35Date: Mon, 8 Aug 2022 10:50:09 -0700
36Subject: [PATCH] Fix extra field processing bug that dereferences NULL
37 state->head.
38
39The recent commit to fix a gzip header extra field processing bug
40introduced the new bug fixed here.
41---
42 inflate.c | 4 ++--
43 1 file changed, 2 insertions(+), 2 deletions(-)
44
45diff --git a/inflate.c b/inflate.c
46index 7a7289749..2a3c4fe98 100644
47--- a/inflate.c
48+++ b/inflate.c
49@@ -763,10 +763,10 @@ int flush;
50 copy = state->length;
51 if (copy > have) copy = have;
52 if (copy) {
53- len = state->head->extra_len - state->length;
54 if (state->head != Z_NULL &&
55 state->head->extra != Z_NULL &&
56- len < state->head->extra_max) {
57+ (len = state->head->extra_len - state->length) <
58+ state->head->extra_max) {
59 zmemcpy(state->head->extra + len, next,
60 len + copy > state->head->extra_max ?
61 state->head->extra_max - len : copy);
This page took 0.056975 seconds and 4 git commands to generate.