Added tests against the SIGSEGV of ticket 146

This commit is contained in:
Thomas Schmitt 2008-11-26 21:06:37 +00:00
parent d1483a15da
commit 9d99e7874a
2 changed files with 36 additions and 3 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2008.11.15.220652" #define Cdrskin_timestamP "2008.11.26.210608"

View File

@ -532,12 +532,41 @@ int burn_disc_cd_toc_extensions(struct burn_disc *d, int flag)
int sidx, tidx; int sidx, tidx;
struct burn_toc_entry *entry, *prev_entry= NULL; struct burn_toc_entry *entry, *prev_entry= NULL;
/* ts A81126 : ticket 146 : There is a SIGSIGV in here */
char msg_data[81], *msg;
strcpy(msg_data, "burn_disc_cd_toc_extensions : ");
msg = msg_data + strlen(msg_data);
if (d->session == NULL) {
strcpy(msg, "d->session == NULL");
goto failure;
}
for (sidx = 0; sidx < d->sessions; sidx++) { for (sidx = 0; sidx < d->sessions; sidx++) {
if (d->session[sidx] == NULL) {
sprintf(msg, "d->session[%d] == NULL", sidx);
goto failure;
}
if (d->session[sidx]->track == NULL) {
sprintf(msg, "d->session[%d]->track == NULL", sidx);
goto failure;
}
for (tidx = 0; tidx < d->session[sidx]->tracks + 1; tidx++) { for (tidx = 0; tidx < d->session[sidx]->tracks + 1; tidx++) {
if (tidx < d->session[sidx]->tracks) if (tidx < d->session[sidx]->tracks) {
if (d->session[sidx]->track[tidx] == NULL) {
sprintf(msg,
"d->session[%d]->track[%d] == NULL",
sidx, tidx);
goto failure;
}
entry = d->session[sidx]->track[tidx]->entry; entry = d->session[sidx]->track[tidx]->entry;
else } else
entry = d->session[sidx]->leadout_entry; entry = d->session[sidx]->leadout_entry;
if (entry == NULL) {
sprintf(msg,
"session %d, track %d of %d, entry == NULL",
sidx, tidx, d->session[sidx]->tracks);
goto failure;
}
entry->session_msb = 0; entry->session_msb = 0;
entry->point_msb = 0; entry->point_msb = 0;
entry->start_lba = burn_msf_to_lba(entry->pmin, entry->start_lba = burn_msf_to_lba(entry->pmin,
@ -558,6 +587,10 @@ int burn_disc_cd_toc_extensions(struct burn_disc *d, int flag)
} }
} }
return 1; return 1;
failure:
libdax_msgs_submit(libdax_messenger, -1, 0x00000001,
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH, msg_data, 0, 0);
return 0;
} }