From ff039e80963b59cff2eda6893b32de071b0fa2f7 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 8 Aug 2018 17:27:09 +0200 Subject: [PATCH] Bug fix: SIGSEGV could happen if a track ended by reaching its fixed size while the track source still was willing to deliver bytes --- cdrskin/cdrskin_timestamp.h | 2 +- libburn/file.c | 23 +++++++++++++++++++++++ libburn/libdax_msgs.h | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/cdrskin/cdrskin_timestamp.h b/cdrskin/cdrskin_timestamp.h index 6783d94..fd849e9 100644 --- a/cdrskin/cdrskin_timestamp.h +++ b/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2018.02.05.103650" +#define Cdrskin_timestamP "2018.08.08.152622" diff --git a/libburn/file.c b/libburn/file.c index 78ac074..3cd4691 100644 --- a/libburn/file.c +++ b/libburn/file.c @@ -331,8 +331,31 @@ static int fifo_set_size(struct burn_source *source, off_t size) static void fifo_free(struct burn_source *source) { struct burn_source_fifo *fs = source->data; + int wait_count; + static int wait_max = 30, wait_usleep = 100000; burn_fifo_abort(fs, 0); + for (wait_count = 0; wait_count <= wait_max; wait_count++) { + if (fs->thread_is_valid <= 0) + break; + if (wait_count < wait_max) + usleep(wait_usleep); + } + if (wait_count > wait_max) { + /* The shoveler thread might still be active. If so, it would + use invalid or inappropriate memory if the fifo would be + disposed now. A memory and resource leak is the better + option here. + */ + libdax_msgs_submit(libdax_messenger, -1, + 0x000201ab, + LIBDAX_MSGS_SEV_WARNING, + LIBDAX_MSGS_PRIO_HIGH, + "Leaving burn_source_fifo object undisposed because it is possibly stuck but alive", + 0, 0); + return; + } + if (fs->inp != NULL) burn_source_free(fs->inp); diff --git a/libburn/libdax_msgs.h b/libburn/libdax_msgs.h index c408e09..b9be1a1 100644 --- a/libburn/libdax_msgs.h +++ b/libburn/libdax_msgs.h @@ -613,6 +613,7 @@ Range "scdbackup" : 0x00020000 to 0x0002ffff 0x000201a8 (FAILURE,HIGH) = SCSI command yielded driver problem 0x000201a9 (FAILURE,HIGH) = Implausible length from GET CONFIGURATION 0x000201aa (FAILURE,HIGH) = No CD-TEXT packs in file + 0x000201ab (WARN,HIGH) = Leaving burn_source_fifo object undisposed libdax_audioxtr: