Browse Source

Fix serious bugs related with El-Torito.

release-1.5.4.branch
Vreixo Formoso 15 years ago
parent
commit
9a70496d3c
  1. 1
      demo/iso_modify.c
  2. 12
      libisofs/eltorito.c
  3. 5
      libisofs/stream.c

1
demo/iso_modify.c

@ -86,6 +86,7 @@ int main(int argc, char **argv)
printf("Cant create write opts, error %d\n", result);
return 1;
}
/* for isolinux: iso_write_opts_set_allow_full_ascii(opts, 1); */
result = iso_image_create_burn_source(image, opts, &burn_src);
if (result < 0) {

12
libisofs/eltorito.c

@ -502,8 +502,7 @@ write_validation_entry(uint8_t *buf)
/* calculate the checksum, to ensure sum of all words is 0 */
checksum = 0;
for (i = 0; i < sizeof(struct el_torito_validation_entry); i += 2) {
checksum -= buf[i];
checksum -= (buf[i] << 8);
checksum -= (int16_t) ((buf[i+1] << 8) | buf[i]);
}
iso_lsb(ve->checksum, checksum, 2);
}
@ -775,8 +774,6 @@ int patch_boot_image(uint8_t *buf, Ecma119Image *t, size_t imgsize)
"Isolinux image too small. We won't patch it.");
}
memset(&info, 0, sizeof(info));
/* compute checksum, as the the sum of all 32 bit words in boot image
* from offset 64 */
checksum = 0;
@ -794,7 +791,7 @@ int patch_boot_image(uint8_t *buf, Ecma119Image *t, size_t imgsize)
/* patch boot info table */
info = (struct boot_info_table*)(buf + 8);
memset(info, 0, sizeof(struct boot_info_table));
/*memset(info, 0, sizeof(struct boot_info_table));*/
iso_lsb(info->bi_pvd, t->ms_block + 16, 4);
iso_lsb(info->bi_file, t->bootimg->block, 4);
iso_lsb(info->bi_length, imgsize, 4);
@ -903,6 +900,11 @@ int eltorito_writer_create(Ecma119Image *target)
return ret;
}
target->bootimg = src;
/* if we have selected to patch the image, it needs to be copied always */
if (target->catalog->image->isolinux) {
src->prev_img = 0;
}
/* we need the bootable volume descriptor */
target->curblock++;

5
libisofs/stream.c

@ -284,8 +284,13 @@ int mem_read(IsoStream *stream, void *buf, size_t count)
return ISO_FILE_NOT_OPENNED;
}
if (data->offset >= data->size) {
return 0; /* EOF */
}
len = MIN(count, data->size - data->offset);
memcpy(buf, data->buf + data->offset, len);
data->offset += len;
return len;
}

Loading…
Cancel
Save