Handle eventual ridiculously high d->last_track_no

This commit is contained in:
Thomas Schmitt 2007-02-14 12:20:32 +00:00
parent 636f5278ad
commit ff6a9fc92b
3 changed files with 20 additions and 6 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2007.02.14.120213" #define Cdrskin_timestamP "2007.02.14.121440"

View File

@ -350,6 +350,7 @@ Range "scdbackup" : 0x00020000 to 0x0002ffff
0x00020129 (SORRY,HIGH) = Will not format media type 0x00020129 (SORRY,HIGH) = Will not format media type
0x0002012a (FATAL,HIGH) = Cannot inquire write mode capabilities 0x0002012a (FATAL,HIGH) = Cannot inquire write mode capabilities
0x0002012b (FATAL,HIGH) = Drive offers no suitable write mode with this job 0x0002012b (FATAL,HIGH) = Drive offers no suitable write mode with this job
0x0002012c (SORRY,HIGH) = Too many logical tracks recorded
0x00020130 (SORRY,HIGH) = Drive and media state unsuitable for blanking 0x00020130 (SORRY,HIGH) = Drive and media state unsuitable for blanking
0x00020131 (SORRY,HIGH) = No suitable formatting type offered by drive 0x00020131 (SORRY,HIGH) = No suitable formatting type offered by drive

View File

@ -163,8 +163,7 @@ int mmc_function_spy_ctrl(int do_tell)
/* ts A70201 */ /* ts A70201 */
int mmc_four_char_to_int(unsigned char *data) int mmc_four_char_to_int(unsigned char *data)
{ {
return (data[0] << 24) | (data[1] << 16) | return (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3];
(data[2] << 8) | data[3];
} }
@ -316,6 +315,11 @@ int mmc_get_nwa(struct burn_drive *d, int trackno, int *lba, int *nwa)
} }
if (num > 0) if (num > 0)
d->media_capacity_remaining = ((off_t) num) * ((off_t) 2048); d->media_capacity_remaining = ((off_t) num) * ((off_t) 2048);
/*
fprintf(stderr, "LIBBURN_DEBUG: track info data[16..19] = %2.2X %2.2X %2.2X %2.2X\n", data[16], data[17], data[18], data[19]);
*/
return 1; return 1;
} }
@ -565,10 +569,21 @@ int mmc_fake_toc(struct burn_drive *d)
struct buffer buf; struct buffer buf;
int i, session_number, prev_session = -1, ret, lba; int i, session_number, prev_session = -1, ret, lba;
unsigned char *tdata, size_data[4], start_data[4]; unsigned char *tdata, size_data[4], start_data[4];
char msg[160];
if (d->last_track_no <= 0 || d->complete_sessions <= 0 || if (d->last_track_no <= 0 || d->complete_sessions <= 0 ||
d->status == BURN_DISC_BLANK) d->status == BURN_DISC_BLANK)
return 2; return 2;
if (d->last_track_no > BURN_MMC_FAKE_TOC_MAX_SIZE) {
sprintf(msg,
"Too many logical tracks recorded (%d , max. %d)\n",
d->last_track_no, BURN_MMC_FAKE_TOC_MAX_SIZE);
libdax_msgs_submit(libdax_messenger, d->global_index,
0x0002012c,
LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH,
msg, 0,0);
return 0;
}
d->disc = burn_disc_create(); d->disc = burn_disc_create();
if (d->disc == NULL) if (d->disc == NULL)
return -1; return -1;
@ -601,10 +616,8 @@ int mmc_fake_toc(struct burn_drive *d)
*/ */
for (i = 0; i < d->last_track_no; i++) { for (i = 0; i < d->last_track_no; i++) {
ret = mmc_read_track_info(d, i+1, &buf); ret = mmc_read_track_info(d, i+1, &buf);
if (ret < 0) if (ret <= 0)
return ret; return ret;
if (ret == 0)
continue;
tdata = buf.data; tdata = buf.data;
session_number = (tdata[33] << 8) | tdata[3]; session_number = (tdata[33] << 8) | tdata[3];
if (session_number <= 0) if (session_number <= 0)