diff --git a/libisofs/libisofs.h b/libisofs/libisofs.h index 490085c..2b652bb 100644 --- a/libisofs/libisofs.h +++ b/libisofs/libisofs.h @@ -7003,7 +7003,6 @@ int iso_image_hfsplus_bless(IsoImage *img, enum IsoHfsplusBlessings blessing, (FAILURE, HIGH, -343) */ #define ISO_AAIP_NON_USER_NAME 0xE830FEA9 - /** Too many references on a single IsoExternalFilterCommand (FAILURE, HIGH, -344) */ #define ISO_EXTF_TOO_OFTEN 0xE830FEA8 @@ -7171,9 +7170,12 @@ int iso_image_hfsplus_bless(IsoImage *img, enum IsoHfsplusBlessings blessing, (FAILURE, HIGH, -382) */ #define ISO_SECT_SCATTERED 0xE830FE82 -/** Too many Apple Partition Map entries requested (FAILURE, HIGH, -383)*/ +/** Too many Apple Partition Map entries requested (FAILURE, HIGH, -383) */ #define ISO_BOOT_TOO_MANY_APM 0xE830FE81 +/** Overlapping Apple Partition Map entries requested (FAILURE, HIGH, -384) */ +#define ISO_BOOT_APM_OVERLAP 0xE830FE80 + /* Internal developer note: diff --git a/libisofs/messages.c b/libisofs/messages.c index d2587eb..1ea9f2a 100644 --- a/libisofs/messages.c +++ b/libisofs/messages.c @@ -476,6 +476,8 @@ const char *iso_error_to_msg(int errcode) return "File sections do not form consecutive array of blocks"; case ISO_BOOT_TOO_MANY_APM: return "Too many Apple Partition Map entries requested"; + case ISO_BOOT_APM_OVERLAP: + return "Overlapping Apple Partition Map entries requested"; default: return "Unknown error"; } diff --git a/libisofs/system_area.c b/libisofs/system_area.c index cbb0e4a..b4d71c7 100644 --- a/libisofs/system_area.c +++ b/libisofs/system_area.c @@ -800,8 +800,10 @@ static int iso_write_apm(Ecma119Image *t, uint32_t img_blocks, uint8_t *buf) if (t->apm_req_count <= 0) { /* ret = iso_quick_apm_entry(t, 16, 20, "Test1_name_16_20", "Test1_type"); - */ ret = iso_quick_apm_entry(t, 30, 20, "Test1_name_30_20", "Test1_type"); + */ + /* >>> Caution: Size 90 causes intentional partition overlap error */ + ret = iso_quick_apm_entry(t, 30, 90, "BAD_30_90_BAD", "Test1_type"); if (ret < 0) return ret; ret = iso_quick_apm_entry(t, 100, 400, "Test2_name_100_400", @@ -846,16 +848,15 @@ static int iso_write_apm(Ecma119Image *t, uint32_t img_blocks, uint8_t *buf) t->apm_req[i - 1]->block_count; } if (part_end > goal) { - - /* >>> Overlapping partition. */; - /* >>> Vladimir: "Throw error." */; - + iso_msg_submit(t->image->id, ISO_BOOT_APM_OVERLAP, 0, + "Program error: APM partitions %d and %d oberlap by %lu blocks", + i - 1, i, part_end - goal); + return ISO_BOOT_APM_OVERLAP; } if (part_end < goal) { sprintf(gap_name, "Gap%d", gap_counter); gap_counter++; - ret = iso_quick_apm_entry(t, part_end, - goal - part_end, + ret = iso_quick_apm_entry(t, part_end, goal - part_end, gap_name, "ISO9660_data"); if (ret < 0) return ret;