mirror of
https://git.yoctoproject.org/poky
synced 2026-03-27 16:02:21 +01:00
grub: fix a possible integer overflow
This patch adds a fix for a possible integer overflow in grub's video/fb/video_fb. It is a part of a security series [1]. [1] https://lists.gnu.org/archive/html/grub-devel/2021-03/msg00007.html (From OE-Core rev: d15e7cc6fc7de358da2fd1faa8a8ea5bc2fabe98) Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com> Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
628257a582
commit
eca24c02ea
@@ -0,0 +1,39 @@
|
||||
From aac5574ff340a665ccc78d4c3d61596ac67acbbe Mon Sep 17 00:00:00 2001
|
||||
From: Darren Kenny <darren.kenny@oracle.com>
|
||||
Date: Fri, 4 Dec 2020 14:51:30 +0000
|
||||
Subject: [PATCH] video/fb/video_fb: Fix possible integer overflow
|
||||
|
||||
It is minimal possibility that the values being used here will overflow.
|
||||
So, change the code to use the safemath function grub_mul() to ensure
|
||||
that doesn't happen.
|
||||
|
||||
Fixes: CID 73761
|
||||
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
|
||||
Upstream-Status: Backport [https://git.savannah.gnu.org/cgit/grub.git/commit/?id=08413f2f4edec0e2d9bf15f836f6ee5ca2e379cb]
|
||||
Signed-off-by: Marta Rybczynska <marta.rybczynska@huawei.com>
|
||||
---
|
||||
grub-core/video/fb/video_fb.c | 8 +++++++-
|
||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/video/fb/video_fb.c b/grub-core/video/fb/video_fb.c
|
||||
index 1c9a138..ae6b89f 100644
|
||||
--- a/grub-core/video/fb/video_fb.c
|
||||
+++ b/grub-core/video/fb/video_fb.c
|
||||
@@ -1537,7 +1537,13 @@ doublebuf_pageflipping_init (struct grub_video_mode_info *mode_info,
|
||||
volatile void *page1_ptr)
|
||||
{
|
||||
grub_err_t err;
|
||||
- grub_size_t page_size = mode_info->pitch * mode_info->height;
|
||||
+ grub_size_t page_size = 0;
|
||||
+
|
||||
+ if (grub_mul (mode_info->pitch, mode_info->height, &page_size))
|
||||
+ {
|
||||
+ /* Shouldn't happen, but if it does we've a bug. */
|
||||
+ return GRUB_ERR_BUG;
|
||||
+ }
|
||||
|
||||
framebuffer.offscreen_buffer = grub_malloc (page_size);
|
||||
if (! framebuffer.offscreen_buffer)
|
||||
@@ -80,6 +80,7 @@ SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \
|
||||
file://0031-video-efi_gop-Remove-unnecessary-return-value-of-gru.patch \
|
||||
file://0032-video-fb-fbfill-Fix-potential-integer-overflow.patch \
|
||||
file://0033-video-fb-video_fb-Fix-multiple-integer-overflows.patch \
|
||||
file://0034-video-fb-video_fb-Fix-possible-integer-overflow.patch \
|
||||
"
|
||||
SRC_URI[md5sum] = "5ce674ca6b2612d8939b9e6abed32934"
|
||||
SRC_URI[sha256sum] = "f10c85ae3e204dbaec39ae22fa3c5e99f0665417e91c2cb49b7e5031658ba6ea"
|
||||
|
||||
Reference in New Issue
Block a user