37 lines
1.2 KiB
Diff
37 lines
1.2 KiB
Diff
From c3093b6240302e52438469857fec616aa4b294a3 Mon Sep 17 00:00:00 2001
|
|
From: Daniel Axtens <dja@axtens.net>
|
|
Date: Fri, 8 Mar 2024 22:47:20 +1100
|
|
Subject: [PATCH 09/20] video/readers/jpeg: Do not permit duplicate SOF0
|
|
markers in JPEG
|
|
|
|
Otherwise a subsequent header could change the height and width
|
|
allowing future OOB writes.
|
|
|
|
Fixes: CVE-2024-45774
|
|
|
|
Reported-by: Nils Langius <nils@langius.de>
|
|
Signed-off-by: Daniel Axtens <dja@axtens.net>
|
|
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
|
---
|
|
grub-core/video/readers/jpeg.c | 4 ++++
|
|
1 file changed, 4 insertions(+)
|
|
|
|
diff --git a/grub-core/video/readers/jpeg.c b/grub-core/video/readers/jpeg.c
|
|
index ae634fd419..631a893564 100644
|
|
--- a/grub-core/video/readers/jpeg.c
|
|
+++ b/grub-core/video/readers/jpeg.c
|
|
@@ -339,6 +339,10 @@ grub_jpeg_decode_sof (struct grub_jpeg_data *data)
|
|
if (grub_errno != GRUB_ERR_NONE)
|
|
return grub_errno;
|
|
|
|
+ if (data->image_height != 0 || data->image_width != 0)
|
|
+ return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
|
+ "jpeg: cannot have duplicate SOF0 markers");
|
|
+
|
|
if (grub_jpeg_get_byte (data) != 8)
|
|
return grub_error (GRUB_ERR_BAD_FILE_TYPE,
|
|
"jpeg: only 8-bit precision is supported");
|
|
--
|
|
2.48.1
|
|
|