diff options
| author | Hitendra Prajapati <hprajapati@mvista.com> | 2022-07-26 12:34:02 +0530 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-08 16:23:34 +0100 |
| commit | 9e7f4a7db257a865100e135f076cc31c14a71bd3 (patch) | |
| tree | b97a502f6edc132b55a6a16bc1605ed65a330e54 /meta/recipes-bsp/grub/files/CVE-2021-3696.patch | |
| parent | e4946bd39eed9f4127e55c369bdbd9f35d832d9d (diff) | |
| download | poky-9e7f4a7db257a865100e135f076cc31c14a71bd3.tar.gz | |
grub2: Fix buffer underflow write in the heap
Source: https://git.savannah.gnu.org/gitweb/?p=grub.git
MR: 119719, 119733, 119689
Type: Security Fix
Disposition: Backport from https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commit;h=e623866d9286410156e8b9d2c82d6253a1b22d08 && https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commit;h=210245129c932dc9e1c2748d9d35524fb95b5042 && https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commit;h=22a3f97d39f6a10b08ad7fd1cc47c4dcd10413f6
ChangeID: 97605970cd42776fa449fd8318f2762e32bbd177
Description:
Fixed CVEs :
CVE-2021-3695
CVE-2021-3696
CVE-2021-3697
Affects "grub2 < 2.06"
(From OE-Core rev: 191db3c58b52fa7c8530d82f7e3e3b24075fdeb4)
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-bsp/grub/files/CVE-2021-3696.patch')
| -rw-r--r-- | meta/recipes-bsp/grub/files/CVE-2021-3696.patch | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/meta/recipes-bsp/grub/files/CVE-2021-3696.patch b/meta/recipes-bsp/grub/files/CVE-2021-3696.patch new file mode 100644 index 0000000000..ef6da945c4 --- /dev/null +++ b/meta/recipes-bsp/grub/files/CVE-2021-3696.patch | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | From b18ce59d6496a9313d75f9497a0efac61dcf4191 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Hitendra Prajapati <hprajapati@mvista.com> | ||
| 3 | Date: Wed, 20 Jul 2022 10:05:42 +0530 | ||
| 4 | Subject: [PATCH] CVE-2021-3696 | ||
| 5 | |||
| 6 | Upstream-Status: Backport [https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commit;h=210245129c932dc9e1c2748d9d35524fb95b5042] | ||
| 7 | CVE: CVE-2021-3696 | ||
| 8 | Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com> | ||
| 9 | |||
| 10 | video/readers/png: Avoid heap OOB R/W inserting huff table items | ||
| 11 | |||
| 12 | In fuzzing we observed crashes where a code would attempt to be inserted | ||
| 13 | into a huffman table before the start, leading to a set of heap OOB reads | ||
| 14 | and writes as table entries with negative indices were shifted around and | ||
| 15 | the new code written in. | ||
| 16 | |||
| 17 | Catch the case where we would underflow the array and bail. | ||
| 18 | |||
| 19 | Fixes: CVE-2021-3696 | ||
| 20 | Signed-off-by: Daniel Axtens <dja@axtens.net> | ||
| 21 | Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com> | ||
| 22 | --- | ||
| 23 | grub-core/video/readers/png.c | 7 +++++++ | ||
| 24 | 1 file changed, 7 insertions(+) | ||
| 25 | |||
| 26 | diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c | ||
| 27 | index 36b3f10..3c05951 100644 | ||
| 28 | --- a/grub-core/video/readers/png.c | ||
| 29 | +++ b/grub-core/video/readers/png.c | ||
| 30 | @@ -416,6 +416,13 @@ grub_png_insert_huff_item (struct huff_table *ht, int code, int len) | ||
| 31 | for (i = len; i < ht->max_length; i++) | ||
| 32 | n += ht->maxval[i]; | ||
| 33 | |||
| 34 | + if (n > ht->num_values) | ||
| 35 | + { | ||
| 36 | + grub_error (GRUB_ERR_BAD_FILE_TYPE, | ||
| 37 | + "png: out of range inserting huffman table item"); | ||
| 38 | + return; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | for (i = 0; i < n; i++) | ||
| 42 | ht->values[ht->num_values - i] = ht->values[ht->num_values - i - 1]; | ||
| 43 | |||
| 44 | -- | ||
| 45 | 2.25.1 | ||
| 46 | |||
