diff options
Diffstat (limited to 'meta/recipes-core/busybox/busybox/CVE-2021-42374.patch')
-rw-r--r-- | meta/recipes-core/busybox/busybox/CVE-2021-42374.patch | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/meta/recipes-core/busybox/busybox/CVE-2021-42374.patch b/meta/recipes-core/busybox/busybox/CVE-2021-42374.patch new file mode 100644 index 0000000000..aef8a3db85 --- /dev/null +++ b/meta/recipes-core/busybox/busybox/CVE-2021-42374.patch | |||
@@ -0,0 +1,53 @@ | |||
1 | From 04f052c56ded5ab6a904e3a264a73dc0412b2e78 Mon Sep 17 00:00:00 2001 | ||
2 | From: Denys Vlasenko <vda.linux@googlemail.com> | ||
3 | Date: Tue, 15 Jun 2021 15:07:57 +0200 | ||
4 | Subject: [PATCH] unlzma: fix a case where we could read before beginning of | ||
5 | buffer | ||
6 | Cc: pavel@zhukoff.net | ||
7 | |||
8 | Testcase: | ||
9 | |||
10 | 21 01 01 00 00 00 00 00 e7 01 01 01 ef 00 df b6 | ||
11 | 00 17 02 10 11 0f ff 00 16 00 00 | ||
12 | |||
13 | Unfortunately, the bug is not reliably causing a segfault, | ||
14 | the behavior depends on what's in memory before the buffer. | ||
15 | |||
16 | function old new delta | ||
17 | unpack_lzma_stream 2762 2768 +6 | ||
18 | |||
19 | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> | ||
20 | |||
21 | Signed-off-by: Pavel Zhukov <pavel.zhukov@huawei.com> | ||
22 | |||
23 | CVE: CVE-2021-42374 | ||
24 | Upstream-Status: Backport [https://git.busybox.net/busybox/commit/?h=1_33_stable&id=d326be2850ea2bd78fe2c22d6c45c3b861d82937] | ||
25 | Comment: testdata dropped because of binary format | ||
26 | |||
27 | --- | ||
28 | archival/libarchive/decompress_unlzma.c | 5 ++++- | ||
29 | testsuite/unlzma.tests | 17 +++++++++++++---- | ||
30 | testsuite/unlzma_issue_3.lzma | Bin 0 -> 27 bytes | ||
31 | 3 files changed, 17 insertions(+), 5 deletions(-) | ||
32 | create mode 100644 testsuite/unlzma_issue_3.lzma | ||
33 | |||
34 | diff --git a/archival/libarchive/decompress_unlzma.c b/archival/libarchive/decompress_unlzma.c | ||
35 | index 0744f231a1d64d92676b0cada2342f88f3b39b31..fb5aac8fe9ea0c53e0c2d7a7cbd05a753e39bc9d 100644 | ||
36 | --- a/archival/libarchive/decompress_unlzma.c | ||
37 | +++ b/archival/libarchive/decompress_unlzma.c | ||
38 | @@ -290,8 +290,11 @@ unpack_lzma_stream(transformer_state_t *xstate) | ||
39 | uint32_t pos; | ||
40 | |||
41 | pos = buffer_pos - rep0; | ||
42 | - if ((int32_t)pos < 0) | ||
43 | + if ((int32_t)pos < 0) { | ||
44 | pos += header.dict_size; | ||
45 | + if ((int32_t)pos < 0) | ||
46 | + goto bad; | ||
47 | + } | ||
48 | match_byte = buffer[pos]; | ||
49 | do { | ||
50 | int bit; | ||
51 | -- | ||
52 | 2.34.0 | ||
53 | |||