* 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.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-06-02 20:15:11 +02:00
parent 0d3d137e79
commit 6e5efd60a1
4 changed files with 16 additions and 5 deletions

View file

@ -1,3 +1,10 @@
2012-06-02 Vladimir Serbinenko <phcoder@gmail.com>
* 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 <isaoshimizu@gmail.com> 2012-06-02 Isao Shimizu <isaoshimizu@gmail.com>
* util/ieee1275/ofpath.c (check_sas): Fix sas path. * util/ieee1275/ofpath.c (check_sas): Fix sas path.

View file

@ -368,7 +368,7 @@ grub_video_gop_setup (unsigned int width, unsigned int height,
{ {
err = 1; err = 1;
grub_gop_get_preferred_mode (&preferred_width, &preferred_height); grub_gop_get_preferred_mode (&preferred_width, &preferred_height);
if (err) if (err || preferred_width >= 4096 || preferred_height >= 4096)
{ {
preferred_width = 800; preferred_width = 800;
preferred_height = 600; preferred_height = 600;

View file

@ -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. */ /* Use low memory scratch area as temporary storage for VESA BIOS calls. */
flat_panel_info = (struct grub_vbe_flat_panel_info *) flat_panel_info = (struct grub_vbe_flat_panel_info *)
(GRUB_MEMORY_MACHINE_SCRATCH_ADDR + sizeof (struct grub_video_edid_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 if (controller_info.version >= 0x200
&& (grub_vbe_bios_get_ddc_capabilities (&ddc_level) & 0xff) && (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 if (grub_video_vbe_get_edid (&edid_info) == GRUB_ERR_NONE
&& grub_video_edid_checksum (&edid_info) == GRUB_ERR_NONE && grub_video_edid_checksum (&edid_info) == GRUB_ERR_NONE
&& grub_video_edid_preferred_mode (&edid_info, width, height) && grub_video_edid_preferred_mode (&edid_info, width, height)
== GRUB_ERR_NONE) == GRUB_ERR_NONE && *width < 4096 && *height < 4096)
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
grub_errno = 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); 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; *width = flat_panel_info->horizontal_size;
*height = flat_panel_info->vertical_size; *height = flat_panel_info->vertical_size;

View file

@ -415,6 +415,7 @@ grub_video_edid_preferred_mode (struct grub_video_edid_info *edid_info,
| (((unsigned int) | (((unsigned int)
(edid_info->detailed_timings[0].vertical_hi & 0xf0)) (edid_info->detailed_timings[0].vertical_hi & 0xf0))
<< 4); << 4);
if (*width && *height)
return GRUB_ERR_NONE; return GRUB_ERR_NONE;
} }