65c99394ff
Grub 2.06 is affected by a number of CVEs, which have been fixed in the master branch of Grub, but are not yet part of any release (there is a 2.12-rc1 release, but nothing else between 2.06 and 2.12-rc1). So this patch backports the relevant fixes for CVE-2022-28736, CVE-2022-28735, CVE-2021-3695, CVE-2021-3696, CVE-2021-3697, CVE-2022-28733, CVE-2022-28734, CVE-2022-2601 and CVE-2022-3775. It should be noted that CVE-2021-3695, CVE-2021-3696, CVE-2021-3697 are not reported as affecting Grub by our CVE matching logic because the NVD database uses an incorrect CPE ID in those CVEs: it uses "grub" as the product instead of "grub2" like all other CVEs for grub. This issue has been reported to the NVD maintainers. This requires backporting a lot of patches, but jumping from 2.06 to 2.12-rc1 implies getting 592 commits, which is quite a lot. All Grub test cases are working fine: https://gitlab.com/tpetazzoni/buildroot/-/pipelines/984500585 https://gitlab.com/tpetazzoni/buildroot/-/pipelines/984500679 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> [Arnout: fix check-package warning in patch 0002] Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
45 lines
1.4 KiB
Diff
45 lines
1.4 KiB
Diff
From 43a7d9cb829467993ba683a26c980fcfdaa924c8 Mon Sep 17 00:00:00 2001
|
|
From: Daniel Axtens <dja@axtens.net>
|
|
Date: Tue, 6 Jul 2021 23:25:07 +1000
|
|
Subject: [PATCH] video/readers/png: Avoid heap OOB R/W inserting huff table
|
|
items
|
|
|
|
In fuzzing we observed crashes where a code would attempt to be inserted
|
|
into a huffman table before the start, leading to a set of heap OOB reads
|
|
and writes as table entries with negative indices were shifted around and
|
|
the new code written in.
|
|
|
|
Catch the case where we would underflow the array and bail.
|
|
|
|
Fixes: CVE-2021-3696
|
|
|
|
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
|
Upstream: 210245129c932dc9e1c2748d9d35524fb95b5042
|
|
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
|
---
|
|
grub-core/video/readers/png.c | 7 +++++++
|
|
1 file changed, 7 insertions(+)
|
|
|
|
diff --git a/grub-core/video/readers/png.c b/grub-core/video/readers/png.c
|
|
index a3161e25b..d7ed5aa6c 100644
|
|
--- a/grub-core/video/readers/png.c
|
|
+++ b/grub-core/video/readers/png.c
|
|
@@ -438,6 +438,13 @@ grub_png_insert_huff_item (struct huff_table *ht, int code, int len)
|
|
for (i = len; i < ht->max_length; i++)
|
|
n += ht->maxval[i];
|
|
|
|
+ if (n > ht->num_values)
|
|
+ {
|
|
+ grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
|
+ "png: out of range inserting huffman table item");
|
|
+ return;
|
|
+ }
|
|
+
|
|
for (i = 0; i < n; i++)
|
|
ht->values[ht->num_values - i] = ht->values[ht->num_values - i - 1];
|
|
|
|
--
|
|
2.41.0
|
|
|