diff --git a/ChangeLog b/ChangeLog index 78eaed17e..00f062165 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2012-06-02 Vladimir Serbinenko + + * grub-core/video/efi_gop.c (grub_video_gop_setup): Reject invalid + resolutions. + * grub-core/video/i386/pc/vbe.c (grub_vbe_get_preferred_mode): Likewise. + * grub-core/video/video.c (grub_video_edid_preferred_mode): Likewise. + 2012-06-02 Isao Shimizu * util/ieee1275/ofpath.c (check_sas): Fix sas path. diff --git a/grub-core/video/efi_gop.c b/grub-core/video/efi_gop.c index 3e1cc2357..37a0015c2 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 || preferred_width >= 4096 || preferred_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 5656388a6..81e5a8e94 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 67de85ad9..c36994f55 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");