Bug fix: SIGSEGV happened if options bit 14 of iso_write_opts_set_system_area() is set and no El Torito boot image is defined

This commit is contained in:
Thomas Schmitt 2019-04-18 10:49:40 +02:00
parent c62d9d7b1b
commit 4b21386e82

View File

@ -2145,7 +2145,7 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
return ISO_ASSERT_FAILURE; return ISO_ASSERT_FAILURE;
} }
/* This eventually overwrites the non-mbr_req partition table entries /* This possibly overwrites the non-mbr_req partition table entries
made so far. Overwriting those from t->mbr_req is not allowed. made so far. Overwriting those from t->mbr_req is not allowed.
*/ */
if (sa_type == 3 || !t->opts->appended_as_gpt) { if (sa_type == 3 || !t->opts->appended_as_gpt) {
@ -2175,6 +2175,9 @@ int iso_write_system_area(Ecma119Image *t, uint8_t *buf)
if (sa_type == 0 && (t->system_area_options & 0x4000) && !do_isohybrid) { if (sa_type == 0 && (t->system_area_options & 0x4000) && !do_isohybrid) {
/* Patch MBR for GRUB2 */ /* Patch MBR for GRUB2 */
if (t->num_bootsrc <= 0)
return iso_msg_submit(t->image->id, ISO_BOOT_IMAGE_NOT_VALID, 0,
"No boot image found as jump target for GRUB2 MBR.");
if (t->bootsrc[0] == NULL) if (t->bootsrc[0] == NULL)
return iso_msg_submit(t->image->id, ISO_BOOT_IMAGE_NOT_VALID, 0, return iso_msg_submit(t->image->id, ISO_BOOT_IMAGE_NOT_VALID, 0,
"Cannot refer by GRUB2 MBR to data outside of ISO 9660 filesystem."); "Cannot refer by GRUB2 MBR to data outside of ISO 9660 filesystem.");