Browse Source

Improved error message if a track is larger than 4 TiB - 32 KiB

master
Thomas Schmitt 8 months ago
parent
commit
2a977cfc4b
  1. 2
      cdrskin/cdrskin_timestamp.h
  2. 3
      libburn/libdax_msgs.h
  3. 4
      libburn/sector.c
  4. 31
      libburn/structure.c
  5. 14
      libburn/write.c

2
cdrskin/cdrskin_timestamp.h

@ -1 +1 @@
#define Cdrskin_timestamP "2021.01.30.153517"
#define Cdrskin_timestamP "2021.02.28.121708"

3
libburn/libdax_msgs.h

@ -1,7 +1,7 @@
/* libdax_msgs
Message handling facility of libburn and libisofs.
Copyright (C) 2006-2016 Thomas Schmitt <scdbackup@gmx.net>,
Copyright (C) 2006-2021 Thomas Schmitt <scdbackup@gmx.net>,
provided under GPL version 2 or later.
*/
@ -616,6 +616,7 @@ Range "scdbackup" : 0x00020000 to 0x0002ffff
0x000201ab (WARN,HIGH) = Leaving burn_source_fifo object undisposed
0x000201ac (NOTE,HIGH) = Drive currently does not offer Stream Recording
0x000201ad (NOTE,HIGH) = WRITE commands have been repeated
0x000201ae (FAILURE,HIGH) = Track size exceeds 4 TiB - 32 KiB
libdax_audioxtr:

4
libburn/sector.c

@ -1,7 +1,7 @@
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
/* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
Copyright (c) 2006 - 2016 Thomas Schmitt <scdbackup@gmx.net>
Copyright (c) 2006 - 2021 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later.
*/
@ -194,6 +194,8 @@ static void get_bytes(struct burn_track *track, int count, unsigned char *data)
inp_block_size = burn_sector_length(track->mode);
track_blocks = burn_track_get_sectors_2(track, 1);
if (track_blocks < 0)
track_blocks = 0;
missing = track_blocks * inp_block_size - track->sourcecount;
sprintf(msg,
"Premature end of input encountered. Missing: %.f bytes",

31
libburn/structure.c

@ -1,6 +1,6 @@
/* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
Copyright (c) 2006 - 2014 Thomas Schmitt <scdbackup@gmx.net>
Copyright (c) 2006 - 2021 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later.
*/
@ -533,6 +533,12 @@ int burn_track_get_sectors_2(struct burn_track *t, int flag)
if (t->entry->extensions_valid & 1)
size = ((off_t) t->entry->track_blocks) * (off_t) 2048;
}
if (size > ((off_t) 0x7ffffff0) * (off_t) 2048) {
libdax_msgs_submit(libdax_messenger, -1, 0x000201ae,
LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_PRIO_HIGH,
"Track size exceeds 4 TiB - 32 KiB", 0, 0);
return -1;
}
sectors = size / seclen;
if (size % seclen)
sectors++;
@ -589,13 +595,22 @@ int burn_track_set_fillup(struct burn_track *t, int fill_up_media)
*/
int burn_track_apply_fillup(struct burn_track *t, off_t max_size, int flag)
{
int max_sectors, ret = 2;
int max_sectors, ret = 2, track_sectors;
char msg[80];
if (t->fill_up_media <= 0)
return 2;
if (max_size > (off_t) 0x7ffffff0 * (off_t) 2048) {
libdax_msgs_submit(libdax_messenger, -1, 0x000201ae,
LIBDAX_MSGS_SEV_FAILURE, LIBDAX_MSGS_PRIO_HIGH,
"Track size exceeds 4 TiB - 32 KiB", 0, 0);
return 0;
}
max_sectors = max_size / 2048;
if (burn_track_get_sectors(t) < max_sectors || (flag & 1)) {
track_sectors = burn_track_get_sectors(t);
if (track_sectors < 0)
return 0;
if (track_sectors < max_sectors || (flag & 1)) {
sprintf(msg, "Setting total track size to %ds (payload %ds)\n",
max_sectors & 0x7fffffff,
(int) ((t->source->get_size(t->source) / 2048)
@ -665,10 +680,14 @@ int burn_track_get_shortage(struct burn_track *t)
int burn_session_get_sectors(struct burn_session *s)
{
int sectors = 0, i;
int sectors = 0, i, track_sectors;
for (i = 0; i < s->tracks; i++)
sectors += burn_track_get_sectors(s->track[i]);
for (i = 0; i < s->tracks; i++) {
track_sectors = burn_track_get_sectors(s->track[i]);
if (track_sectors < 0)
track_sectors = 0;
sectors += track_sectors;
}
return sectors;
}

14
libburn/write.c

@ -1,7 +1,7 @@
/* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
/* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
Copyright (c) 2006 - 2017 Thomas Schmitt <scdbackup@gmx.net>
Copyright (c) 2006 - 2021 Thomas Schmitt <scdbackup@gmx.net>
Provided under GPL version 2 or later.
*/
@ -630,6 +630,8 @@ struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
track length.
*/
track_length = burn_track_get_sectors_2(tar[i], 1);
if (track_length < 0)
goto failed;
if (track_length < 300 && !burn_track_is_open_ended(tar[i])) {
track_length = 300;
if (!tar[i]->pad)
@ -1203,6 +1205,8 @@ int burn_write_track(struct burn_write_opts *o, struct burn_session *s,
/* user data */
sectors = burn_track_get_sectors_2(t, 1);
if (sectors < 0)
{ ret = 0; goto ex; }
open_ended = burn_track_is_open_ended(t);
burn_disc_init_track_status(o, s, t, tnum, sectors);
@ -1591,6 +1595,8 @@ int burn_disc_open_track_dvd_minus_r(struct burn_write_opts *o,
if (o->write_type == BURN_WRITE_SAO) { /* DAO */
size = ((off_t) burn_track_get_sectors_2(s->track[tnum], 1))
* (off_t) 2048;
if (size < 0)
{ret = 0; goto ex;}
/* Eventually round track size up to write chunk */
if (o->obs_pad && (size % o->obs))
@ -1640,6 +1646,8 @@ int burn_disc_open_track_dvd_plus_r(struct burn_write_opts *o,
/* Reserve track */
size = ((off_t) burn_track_get_sectors_2(s->track[tnum], 1))
* (off_t) 2048;
if (size < 0)
{ret = 0; goto ex;}
if (o->obs_pad) {
/* Round track size up to write chunk size */
/* o->obs should be 32k or 64k already. But 32k
@ -1932,6 +1940,8 @@ int burn_dvd_write_track(struct burn_write_opts *o,
track_open = 1;
sectors = burn_track_get_sectors_2(t, 1);
if (sectors < 0)
{ret = 0; goto ex;}
open_ended = burn_track_is_open_ended(t);
/* (offset padding is done within sector_data()) */
@ -2835,6 +2845,8 @@ int burn_stdio_write_track(struct burn_write_opts *o, struct burn_session *s,
BURN_ALLOC_MEM(buf, char, bufsize);
sectors = burn_track_get_sectors_2(t, 1);
if (sectors < 0)
{ret = 0; goto ex;}
burn_disc_init_track_status(o, s, t, tnum, sectors);
open_ended = burn_track_is_open_ended(t);

Loading…
Cancel
Save