From e1bb9ebda5aa58db6e546fdc180bfdbed157cc1c Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 18 Dec 2010 00:50:49 +1100 Subject: [PATCH] There's a bug where archives with multiple stream 0 entries per chunk can be corrupted on decompression with threading enabled. Until the bug is tracked down, disable multithreaded decompression when an archive with interleaved stream 0/1 entries is detected. --- stream.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/stream.c b/stream.c index 73cbd3b..6a3a06b 100644 --- a/stream.c +++ b/stream.c @@ -1207,7 +1207,14 @@ fill_another: s->uthread_no, c_len, stream); create_pthread(&threads[s->uthread_no], NULL, ucompthread, (void *)s->uthread_no); - if (!last_head) + if (stream == 0 && last_head && control.threads > 1) { + int i; + + print_verbose("Interleaved streams detected, dropping to single threaded decompression as a precaution.\n"); + for (i = 0; i < NUM_STREAMS; i++) + sinfo->s[i].total_threads = 1; + control.threads = 1; + } else if (!last_head) s->eos = 1; if (++s->uthread_no == s->base_thread + s->total_threads)