mirror of
https://git.proxmox.com/git/grub2
synced 2025-07-24 09:42:26 +00:00
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>
This commit is contained in:
parent
08e098b1db
commit
08413f2f4e
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user