diff --git a/grub-2.00-no-huge-video.patch b/grub-2.00-no-huge-video.patch new file mode 100644 index 0000000..573c7fc --- /dev/null +++ b/grub-2.00-no-huge-video.patch @@ -0,0 +1,67 @@ +From: Valdimir Serbinenko +Subject: Reject huge flat panels and monitors over 4096x4096 + +https://bugzilla.redhat.com/show_bug.cgi?id=827003 + +Backport upstream rev 4412 + +diff --git a/grub-core/video/efi_gop.c b/grub-core/video/efi_gop.c +index 3e1cc23..4628dd0 100644 +--- a/grub-core/video/efi_gop.c ++++ b/grub-core/video/efi_gop.c +@@ -368,7 +368,7 @@ grub_video_gop_setup (unsigned int width, unsigned int height, + { + err = 1; + grub_gop_get_preferred_mode (&preferred_width, &preferred_height); +- if (err) ++ if (err || width >= 4096 || height >= 4096) + { + preferred_width = 800; + preferred_height = 600; +diff --git a/grub-core/video/i386/pc/vbe.c b/grub-core/video/i386/pc/vbe.c +index 5656388..62e530a 100644 +--- a/grub-core/video/i386/pc/vbe.c ++++ b/grub-core/video/i386/pc/vbe.c +@@ -581,7 +581,6 @@ grub_vbe_get_preferred_mode (unsigned int *width, unsigned int *height) + /* Use low memory scratch area as temporary storage for VESA BIOS calls. */ + flat_panel_info = (struct grub_vbe_flat_panel_info *) + (GRUB_MEMORY_MACHINE_SCRATCH_ADDR + sizeof (struct grub_video_edid_info)); +- grub_memset (flat_panel_info, 0, sizeof (*flat_panel_info)); + + if (controller_info.version >= 0x200 + && (grub_vbe_bios_get_ddc_capabilities (&ddc_level) & 0xff) +@@ -590,14 +589,18 @@ grub_vbe_get_preferred_mode (unsigned int *width, unsigned int *height) + if (grub_video_vbe_get_edid (&edid_info) == GRUB_ERR_NONE + && grub_video_edid_checksum (&edid_info) == GRUB_ERR_NONE + && grub_video_edid_preferred_mode (&edid_info, width, height) +- == GRUB_ERR_NONE) ++ == GRUB_ERR_NONE && *width < 4096 && *height < 4096) + return GRUB_ERR_NONE; + + grub_errno = GRUB_ERR_NONE; + } + ++ grub_memset (flat_panel_info, 0, sizeof (*flat_panel_info)); + status = grub_vbe_bios_get_flat_panel_info (flat_panel_info); +- if (status == GRUB_VBE_STATUS_OK) ++ if (status == GRUB_VBE_STATUS_OK ++ && flat_panel_info->horizontal_size && flat_panel_info->vertical_size ++ && flat_panel_info->horizontal_size < 4096 ++ && flat_panel_info->vertical_size < 4096) + { + *width = flat_panel_info->horizontal_size; + *height = flat_panel_info->vertical_size; +diff --git a/grub-core/video/video.c b/grub-core/video/video.c +index 67de85a..c36994f 100644 +--- a/grub-core/video/video.c ++++ b/grub-core/video/video.c +@@ -415,7 +415,8 @@ grub_video_edid_preferred_mode (struct grub_video_edid_info *edid_info, + | (((unsigned int) + (edid_info->detailed_timings[0].vertical_hi & 0xf0)) + << 4); +- return GRUB_ERR_NONE; ++ if (*width && *height) ++ return GRUB_ERR_NONE; + } + + return grub_error (GRUB_ERR_BAD_DEVICE, "no preferred mode available"); diff --git a/grub2.spec b/grub2.spec index c2e121f..0f710c3 100644 --- a/grub2.spec +++ b/grub2.spec @@ -59,6 +59,7 @@ Patch11: grub-2.00-Add-fwsetup.patch Patch13: grub-2.00-Dont-set-boot-on-ppc.patch Patch14: grub-2.00-ignore-gnulib-gets-stupidity.patch Patch15: grub-2.00-linux-mbr.patch +Patch16: grub-2.00-no-huge-video.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)