Avoiding complaints of iso_image_report_system_area() about backup GPT

created by a corrected version of syslinux/utils/isohybrid.c
This commit is contained in:
Thomas Schmitt 2014-06-23 14:31:23 +02:00
parent e26d07ee77
commit 273182aa2a
1 changed files with 6 additions and 9 deletions

View File

@ -4016,11 +4016,12 @@ int iso_analyze_gpt_backup(IsoImage *image, IsoDataSource *src, int flag)
LIBISO_ALLOC_MEM(comments, char, 4096); LIBISO_ALLOC_MEM(comments, char, 4096);
/* Read ISO block with backup head */ /* Read ISO block with backup head */
if (sai->gpt_backup_lba >= ((uint64_t) sai->image_size) * 4) { if (sai->gpt_backup_lba >= ((uint64_t) sai->image_size) * 4 &&
(sai->mbr_req_count < 1 ||
sai->mbr_req[0]->start_block + sai->mbr_req[0]->block_count
!= sai->gpt_backup_lba + 1))
sprintf(comments + strlen(comments), "Implausible header LBA %.f, ", sprintf(comments + strlen(comments), "Implausible header LBA %.f, ",
(double) sai->gpt_backup_lba); (double) sai->gpt_backup_lba);
ret = 0; goto ex;
}
iso_block = sai->gpt_backup_lba / 4; iso_block = sai->gpt_backup_lba / 4;
ret = src->read_block(src, iso_block, buf); ret = src->read_block(src, iso_block, buf);
if (ret < 0) { if (ret < 0) {
@ -4075,11 +4076,9 @@ int iso_analyze_gpt_backup(IsoImage *image, IsoDataSource *src, int flag)
entry_count, sai->gpt_max_entries); entry_count, sai->gpt_max_entries);
ret = 0; goto ex; ret = 0; goto ex;
} }
if (part_start >= ((uint64_t) sai->image_size) * 4) { if (part_start + (entry_count + 3) / 4 != sai->gpt_backup_lba)
sprintf(comments + strlen(comments), "Implausible array LBA %.f, ", sprintf(comments + strlen(comments), "Implausible array LBA %.f, ",
(double) part_start); (double) part_start);
ret = 0; goto ex;
}
iso_block = part_start / 4; iso_block = part_start / 4;
num_iso_blocks = (part_start + (entry_count + 3) / 4) / 4 - iso_block + 1; num_iso_blocks = (part_start + (entry_count + 3) / 4) / 4 - iso_block + 1;
for (i = 0; i < num_iso_blocks; i++) { for (i = 0; i < num_iso_blocks; i++) {
@ -4094,11 +4093,9 @@ int iso_analyze_gpt_backup(IsoImage *image, IsoDataSource *src, int flag)
part_array = buf + (part_start % 4) * 512; part_array = buf + (part_start % 4) * 512;
crc = iso_crc32_gpt((unsigned char *) part_array, 128 * entry_count, 0); crc = iso_crc32_gpt((unsigned char *) part_array, 128 * entry_count, 0);
if (crc != array_crc) { if (crc != array_crc)
sprintf(comments + strlen(comments), sprintf(comments + strlen(comments),
"Array CRC 0x%8x wrong. Should be 0x%8x, ", array_crc, crc); "Array CRC 0x%8x wrong. Should be 0x%8x, ", array_crc, crc);
ret = 0; goto ex;
}
/* Compare entries */ /* Compare entries */
entries_diff = 0; entries_diff = 0;