2008-01-02 Robert Millan <rmh@aybabtu.com>
* loader/i386/pc/multiboot.c (grub_multiboot_load_elf32): Improve error message when loaded image is out of bounds. (grub_multiboot_load_elf64): Likewise.
This commit is contained in:
parent
92695df9e8
commit
b9416d00ad
2 changed files with 23 additions and 9 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2008-01-02 Robert Millan <rmh@aybabtu.com>
|
||||||
|
|
||||||
|
* loader/i386/pc/multiboot.c (grub_multiboot_load_elf32): Improve error
|
||||||
|
message when loaded image is out of bounds.
|
||||||
|
(grub_multiboot_load_elf64): Likewise.
|
||||||
|
|
||||||
2008-01-02 Pavel Roskin <proski@gnu.org>
|
2008-01-02 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
* util/grub.d/10_linux.in: Try version without ".old" when
|
* util/grub.d/10_linux.in: Try version without ".old" when
|
||||||
|
|
|
@ -121,11 +121,15 @@ grub_multiboot_load_elf32 (grub_file_t file, void *buffer)
|
||||||
if (phdr->p_type == PT_LOAD)
|
if (phdr->p_type == PT_LOAD)
|
||||||
{
|
{
|
||||||
/* The segment should fit in the area reserved for the OS. */
|
/* The segment should fit in the area reserved for the OS. */
|
||||||
if ((phdr->p_paddr < grub_os_area_addr)
|
if (phdr->p_paddr < grub_os_area_addr)
|
||||||
|| (phdr->p_paddr + phdr->p_memsz
|
|
||||||
> grub_os_area_addr + grub_os_area_size))
|
|
||||||
return grub_error (GRUB_ERR_BAD_OS,
|
return grub_error (GRUB_ERR_BAD_OS,
|
||||||
"segment doesn't fit in memory reserved for the OS");
|
"segment doesn't fit in memory reserved for the OS (0x%lx < 0x%lx)",
|
||||||
|
phdr->p_paddr, grub_os_area_addr);
|
||||||
|
if (phdr->p_paddr + phdr->p_memsz > grub_os_area_addr + grub_os_area_size)
|
||||||
|
return grub_error (GRUB_ERR_BAD_OS,
|
||||||
|
"segment doesn't fit in memory reserved for the OS (0x%lx > 0x%lx)",
|
||||||
|
phdr->p_paddr + phdr->p_memsz,
|
||||||
|
grub_os_area_addr + grub_os_area_size);
|
||||||
|
|
||||||
if (grub_file_seek (file, (grub_off_t) phdr->p_offset)
|
if (grub_file_seek (file, (grub_off_t) phdr->p_offset)
|
||||||
== (grub_off_t) -1)
|
== (grub_off_t) -1)
|
||||||
|
@ -195,12 +199,16 @@ grub_multiboot_load_elf64 (grub_file_t file, void *buffer)
|
||||||
if (phdr->p_type == PT_LOAD)
|
if (phdr->p_type == PT_LOAD)
|
||||||
{
|
{
|
||||||
/* The segment should fit in the area reserved for the OS. */
|
/* The segment should fit in the area reserved for the OS. */
|
||||||
if ((phdr->p_paddr < (grub_uint64_t) grub_os_area_addr)
|
if (phdr->p_paddr < (grub_uint64_t) grub_os_area_addr)
|
||||||
|| (phdr->p_paddr + phdr->p_memsz
|
|
||||||
> ((grub_uint64_t) grub_os_area_addr
|
|
||||||
+ (grub_uint64_t) grub_os_area_size)))
|
|
||||||
return grub_error (GRUB_ERR_BAD_OS,
|
return grub_error (GRUB_ERR_BAD_OS,
|
||||||
"segment doesn't fit in memory reserved for the OS");
|
"segment doesn't fit in memory reserved for the OS (0x%lx < 0x%lx)",
|
||||||
|
phdr->p_paddr, (grub_uint64_t) grub_os_area_addr);
|
||||||
|
if (phdr->p_paddr + phdr->p_memsz
|
||||||
|
> (grub_uint64_t) grub_os_area_addr + (grub_uint64_t) grub_os_area_size)
|
||||||
|
return grub_error (GRUB_ERR_BAD_OS,
|
||||||
|
"segment doesn't fit in memory reserved for the OS (0x%lx > 0x%lx)",
|
||||||
|
phdr->p_paddr + phdr->p_memsz,
|
||||||
|
(grub_uint64_t) grub_os_area_addr + (grub_uint64_t) grub_os_area_size);
|
||||||
|
|
||||||
if (grub_file_seek (file, (grub_off_t) phdr->p_offset)
|
if (grub_file_seek (file, (grub_off_t) phdr->p_offset)
|
||||||
== (grub_off_t) -1)
|
== (grub_off_t) -1)
|
||||||
|
|
Loading…
Add table
Reference in a new issue