From 585a54d020b35effa898d7be2fe22b46d9ca2624 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 3 Dec 2014 20:22:30 +0100 Subject: [PATCH] Improved size estimation when loading ISO with hidden El Torito images --- libisofs/fs_image.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libisofs/fs_image.c b/libisofs/fs_image.c index b9291a1..0a541e2 100644 --- a/libisofs/fs_image.c +++ b/libisofs/fs_image.c @@ -4684,8 +4684,10 @@ static int iso_impsysa_reduce_next_above(IsoImage *image, uint32_t block, uint32_t *next_above, int flag) { - int i; + int i, section_count, ret; struct iso_imported_sys_area *sai; + struct el_torito_boot_image *img; + struct iso_file_section *sections = NULL; sai = image->imported_sa_info; @@ -4721,6 +4723,17 @@ int iso_impsysa_reduce_next_above(IsoImage *image, uint32_t block, if (image->bootcat->node != NULL) iso_impsysa_reduce_na(block, next_above, image->bootcat->node->lba); + for (i= 0; i < image->bootcat->num_bootimages; i++) { + img = image->bootcat->bootimages[i]; + ret = iso_file_get_old_image_sections(img->image, §ion_count, + §ions, 0); + if (ret > 0 && section_count > 0) + if (block != sections[0].block) + iso_impsysa_reduce_na(block, next_above, sections[0].block); + if (sections != NULL) + free(sections); + } + iso_impsysa_reduce_na(block, next_above, sai->image_size); return ISO_SUCCESS;