From 4ff777ee58c3bfddd1fef7c8ba9e5eb9bb737cb8 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 23 Oct 2012 08:31:42 +0200 Subject: [PATCH] Bug fix: Isohybrid production without any boot image led to SIGSEGV by NULL --- libisofs/make_isohybrid_mbr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libisofs/make_isohybrid_mbr.c b/libisofs/make_isohybrid_mbr.c index 52691d6..18e7e86 100644 --- a/libisofs/make_isohybrid_mbr.c +++ b/libisofs/make_isohybrid_mbr.c @@ -394,7 +394,7 @@ int lba512chs_to_buf(char **wpt, off_t lba, int head_count, int sector_count) int assess_isohybrid_gpt_apm(Ecma119Image *t, int *gpt_count, int gpt_idx[128], int *apm_count, int flag) { - int i, ilx_opts, j, ret; + int i, ilx_opts, j, ret, num_img; uint32_t block_count; uint8_t gpt_name[72]; static uint8_t zero_uuid[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; @@ -412,7 +412,11 @@ int assess_isohybrid_gpt_apm(Ecma119Image *t, int *gpt_count, int gpt_idx[128], *gpt_count = 0; *apm_count = 0; - for (i = 0; i < t->catalog->num_bootimages; i++) { + if (t->catalog != NULL) + num_img = t->catalog->num_bootimages; + else + num_img = 0; + for (i = 0; i < num_img; i++) { ilx_opts = t->catalog->bootimages[i]->isolinux_options; if (((ilx_opts >> 2) & 63) == 1 || ((ilx_opts >> 2) & 63) == 2) { if (*gpt_count < 128)