Bug fix: check_media patch_lba0= could install wrong image size

This commit is contained in:
Thomas Schmitt 2010-06-16 10:57:40 +00:00
parent 969967d2c0
commit 8274b56b6b
2 changed files with 28 additions and 1 deletions

View File

@ -1989,6 +1989,9 @@ int Xorriso_update_iso_lba0(struct XorrisO *xorriso, int iso_lba, int isosize,
struct burn_drive_info *dinfo; struct burn_drive_info *dinfo;
struct burn_drive *drive; struct burn_drive *drive;
off_t seek_ret; off_t seek_ret;
int tag_type;
uint32_t pos, range_start, range_size, next_tag;
char md5[16];
ret= Xorriso_may_burn(xorriso, 0); ret= Xorriso_may_burn(xorriso, 0);
if(ret <= 0) if(ret <= 0)
@ -2040,6 +2043,14 @@ int Xorriso_update_iso_lba0(struct XorrisO *xorriso, int iso_lba, int isosize,
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",0);
return(0); return(0);
} }
ret= isoburn_read_iso_head(drive, 0, &isosize, head_buffer, 1 << 13);
if(ret<=0) {
Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text,
"Alleged session start does not like ISO 9660.");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",0);
return(0);
}
} else { } else {
ret= isoburn_read_iso_head(drive, iso_lba, &isosize, head_buffer, 2); ret= isoburn_read_iso_head(drive, iso_lba, &isosize, head_buffer, 2);
if(ret<=0) { if(ret<=0) {
@ -2057,6 +2068,22 @@ int Xorriso_update_iso_lba0(struct XorrisO *xorriso, int iso_lba, int isosize,
for(i=0;i<4;i++) for(i=0;i<4;i++)
headpt[87-i]= headpt[80+i]= (full_size >> (8*i)) & 0xff; headpt[87-i]= headpt[80+i]= (full_size >> (8*i)) & 0xff;
/* Invalidate eventual libisofs checksum tags */
/* Look for volume descriptor end */
for(i= 16; i < 32; i++)
if(((unsigned char *) head_buffer)[i * 2048] == 0xff &&
strncmp(head_buffer + i * 2048 + 1, "CD001", 5) == 0)
break;
/* Check whether the next one is a libisofs checksum tag */
if(i < 32) {
i++;
ret= iso_util_decode_md5_tag(head_buffer + i * 2048, &tag_type, &pos,
&range_start, &range_size, &next_tag, md5, 0);
if(ret != 0) /* corrupted or not: invalidate */
memset(head_buffer + i * 2048, 0, 8);
}
if(job != NULL) { if(job != NULL) {
seek_ret= lseek(job->data_to_fd, (off_t) 0, SEEK_SET); seek_ret= lseek(job->data_to_fd, (off_t) 0, SEEK_SET);
if(seek_ret == -1) if(seek_ret == -1)

View File

@ -1 +1 @@
#define Xorriso_timestamP "2010.06.16.105449" #define Xorriso_timestamP "2010.06.16.105652"