summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/zlib
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2022-08-14 19:49:50 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-16 14:57:58 +0100
commit70700eab9cca9daaccf4effbc4ff52cae55c619c (patch)
treee1ffb720514cde4ad86025c052c96592804816ee /meta/recipes-core/zlib
parentef5488d7326090e9e78939f7624214b8868b16ae (diff)
downloadpoky-70700eab9cca9daaccf4effbc4ff52cae55c619c.tar.gz
zlib: Resolve CVE-2022-37434
Backport needed fixes CVE: CVE-2022-37434 (From OE-Core rev: f7f089a89a9ba83aa62e4ca1fe9a6b8649b29259) Signed-off-by: Khem Raj <raj.khem@gmail.com> Cc: Paul Eggleton <bluelightning@bluelightning.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/zlib')
-rw-r--r--meta/recipes-core/zlib/zlib/0001-Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch38
-rw-r--r--meta/recipes-core/zlib/zlib/0001-Fix-extra-field-processing-bug-that-dereferences-NUL.patch36
-rw-r--r--meta/recipes-core/zlib/zlib_1.2.12.bb2
3 files changed, 76 insertions, 0 deletions
diff --git a/meta/recipes-core/zlib/zlib/0001-Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch b/meta/recipes-core/zlib/zlib/0001-Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch
new file mode 100644
index 0000000000..96ab563121
--- /dev/null
+++ b/meta/recipes-core/zlib/zlib/0001-Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch
@@ -0,0 +1,38 @@
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 inflate().
5
6If the extra field was larger than the space the user provided with
7inflateGetHeader(), and if multiple calls of inflate() delivered
8the extra header data, then there could be a buffer overflow of the
9provided space. This commit assures that provided space is not
10exceeded.
11
12CVE: CVE-2022-37434
13Upstream-Status: Backport [https://github.com/madler/zlib/commit/eff308af425b67093bab25f80f1ae950166be]
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15---
16 inflate.c | 5 +++--
17 1 file changed, 3 insertions(+), 2 deletions(-)
18
19diff --git a/inflate.c b/inflate.c
20index 7be8c63..7a72897 100644
21--- a/inflate.c
22+++ b/inflate.c
23@@ -763,9 +763,10 @@ int flush;
24 copy = state->length;
25 if (copy > have) copy = have;
26 if (copy) {
27+ len = state->head->extra_len - state->length;
28 if (state->head != Z_NULL &&
29- state->head->extra != Z_NULL) {
30- len = state->head->extra_len - state->length;
31+ state->head->extra != Z_NULL &&
32+ len < state->head->extra_max) {
33 zmemcpy(state->head->extra + len, next,
34 len + copy > state->head->extra_max ?
35 state->head->extra_max - len : copy);
36--
372.37.2
38
diff --git a/meta/recipes-core/zlib/zlib/0001-Fix-extra-field-processing-bug-that-dereferences-NUL.patch b/meta/recipes-core/zlib/zlib/0001-Fix-extra-field-processing-bug-that-dereferences-NUL.patch
new file mode 100644
index 0000000000..a0978c5f95
--- /dev/null
+++ b/meta/recipes-core/zlib/zlib/0001-Fix-extra-field-processing-bug-that-dereferences-NUL.patch
@@ -0,0 +1,36 @@
1From 1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d Mon Sep 17 00:00:00 2001
2From: Mark Adler <fork@madler.net>
3Date: Mon, 8 Aug 2022 10:50:09 -0700
4Subject: [PATCH] Fix extra field processing bug that dereferences NULL
5 state->head.
6
7The recent commit to fix a gzip header extra field processing bug
8introduced the new bug fixed here.
9
10CVE: CVE-2022-37434
11Upstream-Status: Backport [https://github.com/madler/zlib/commit/1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d]
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 inflate.c | 4 ++--
15 1 file changed, 2 insertions(+), 2 deletions(-)
16
17diff --git a/inflate.c b/inflate.c
18index 7a72897..2a3c4fe 100644
19--- a/inflate.c
20+++ b/inflate.c
21@@ -763,10 +763,10 @@ int flush;
22 copy = state->length;
23 if (copy > have) copy = have;
24 if (copy) {
25- len = state->head->extra_len - state->length;
26 if (state->head != Z_NULL &&
27 state->head->extra != Z_NULL &&
28- len < state->head->extra_max) {
29+ (len = state->head->extra_len - state->length) <
30+ state->head->extra_max) {
31 zmemcpy(state->head->extra + len, next,
32 len + copy > state->head->extra_max ?
33 state->head->extra_max - len : copy);
34--
352.37.2
36
diff --git a/meta/recipes-core/zlib/zlib_1.2.12.bb b/meta/recipes-core/zlib/zlib_1.2.12.bb
index 77e7a4937f..b999f13530 100644
--- a/meta/recipes-core/zlib/zlib_1.2.12.bb
+++ b/meta/recipes-core/zlib/zlib_1.2.12.bb
@@ -12,6 +12,8 @@ SRC_URI = "https://zlib.net/${BP}.tar.xz \
12 file://0001-configure-Pass-LDFLAGS-to-link-tests.patch \ 12 file://0001-configure-Pass-LDFLAGS-to-link-tests.patch \
13 file://run-ptest \ 13 file://run-ptest \
14 file://0001-Correct-incorrect-inputs-provided-to-the-CRC-functio.patch \ 14 file://0001-Correct-incorrect-inputs-provided-to-the-CRC-functio.patch \
15 file://0001-Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch \
16 file://0001-Fix-extra-field-processing-bug-that-dereferences-NUL.patch \
15 " 17 "
16UPSTREAM_CHECK_URI = "http://zlib.net/" 18UPSTREAM_CHECK_URI = "http://zlib.net/"
17 19