From 4fdebcae9fe2719f744ff23404c9e20ad65fa5c6 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Fri, 18 Sep 2009 16:18:37 +0000 Subject: [PATCH] Refusing to read beyond media_read_capacity --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/libdax_msgs.h | 1 + libburn/read.c | 12 ++++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 7f308a5..c8782fd 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2009.09.18.161214" +#define Cdrskin_timestamP "2009.09.18.161944" diff --git a/libburn/libdax_msgs.h b/libburn/libdax_msgs.h index 0b332f3..1caac4c 100644 --- a/libburn/libdax_msgs.h +++ b/libburn/libdax_msgs.h @@ -549,6 +549,7 @@ Range "scdbackup" : 0x00020000 to 0x0002ffff 0x0002016f (DEBUG,HIGH) = Unable to grab scanned drive 0x00020170 (NOTE,HIGH) = Closing open session before writing new one 0x00020171 (NOTE,HIGH) = Closing BD-R with accidently open session + 0x00020172 (SORRY,HIGH) = Read start address larger than number of readable blocks libdax_audioxtr: diff --git a/libburn/read.c b/libburn/read.c index bb342dc..8ba5da2 100644 --- a/libburn/read.c +++ b/libburn/read.c @@ -370,6 +370,18 @@ int burn_read_data(struct burn_drive *d, off_t byte_address, msg, 0, 0); return 0; } + if (d->media_read_capacity != 0x7fffffff && byte_address >= + ((off_t) d->media_read_capacity + (off_t) 1) * (off_t) 2048) { + sprintf(msg, + "Read start address %ds larger than number of readable blocks %d", + (int) (byte_address / 2048 + !!(byte_address % 2048)), + d->media_read_capacity); + libdax_msgs_submit(libdax_messenger, d->global_index, + 0x00020172, + LIBDAX_MSGS_SEV_SORRY, LIBDAX_MSGS_PRIO_HIGH, + msg, 0, 0); + return 0; + } if (d->busy != BURN_DRIVE_IDLE) { libdax_msgs_submit(libdax_messenger,