diff --git a/libisoburn/burn_wrap.c b/libisoburn/burn_wrap.c index ec5fce20..554ee990 100644 --- a/libisoburn/burn_wrap.c +++ b/libisoburn/burn_wrap.c @@ -1047,7 +1047,7 @@ int isoburn_read_iso_head(struct burn_drive *d, int lba, int *image_blocks, char *info, int flag) { unsigned char buffer[64*1024]; - int ret, info_mode; + int ret, info_mode, capacity; off_t data_count; info_mode= flag&255; @@ -1055,8 +1055,12 @@ int isoburn_read_iso_head(struct burn_drive *d, int lba, if(flag&(1<<13)) { memcpy(buffer, info, 64*1024); } else { - ret = burn_read_data(d, ((off_t) lba) * (off_t) 2048, (char *) buffer, + ret = burn_get_read_capacity(d, &capacity, 0); + if(ret > 0 && (off_t) capacity * (off_t) 2048 >= (off_t) (64 * 1024)) { + ret = burn_read_data(d, ((off_t) lba) * (off_t) 2048, (char *) buffer, (off_t) 64*1024, &data_count, 2); /* no error messages */ + } else + ret= 0; if(ret<=0) return(-1*!!(flag&(1<<15))); if(info_mode==2) diff --git a/libisoburn/isofs_wrap.c b/libisoburn/isofs_wrap.c index 82c2c124..e3a75fb3 100644 --- a/libisoburn/isofs_wrap.c +++ b/libisoburn/isofs_wrap.c @@ -307,7 +307,7 @@ int isoburn_activate_session(struct burn_drive *drive) */ int isoburn_start_emulation(struct isoburn *o, int flag) { - int ret, i; + int ret, i, capacity; off_t data_count; struct burn_drive *drive; struct ecma119_pri_vol_desc *pvm; @@ -323,8 +323,13 @@ int isoburn_start_emulation(struct isoburn *o, int flag) /* we can assume 0 as start block for image */ /* TODO what about ms? where we validate valid iso image in ms disc? */ - ret = burn_read_data(drive, (off_t) 0, (char*)o->target_iso_head, - (off_t) Libisoburn_target_head_sizE, &data_count, 2); + ret = burn_get_read_capacity(drive, &capacity, 0); + if (ret > 0 && + (off_t) capacity * (off_t) 2048 >= (off_t) Libisoburn_target_head_sizE) { + ret = burn_read_data(drive, (off_t) 0, (char*)o->target_iso_head, + (off_t) Libisoburn_target_head_sizE, &data_count, 2); + } else + ret = 0; /* an error means an empty disc */ if (ret <= 0) { diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index a214c171..1bc5ae56 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2009.09.30.092640" +#define Xorriso_timestamP "2009.10.05.165632"