mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Fix possible race condition between zpaq_decompress_buf() and clear_rulist() function as reported by wcventure.
This commit is contained in:
parent
23407bc8f7
commit
4b3942103b
8
lrzip.c
8
lrzip.c
|
|
@ -842,8 +842,14 @@ bool decompress_file(rzip_control *control)
|
|||
|
||||
print_progress("Decompressing...\n");
|
||||
|
||||
if (unlikely(runzip_fd(control, fd_in, fd_out, fd_hist, expected_size) < 0))
|
||||
if (unlikely(runzip_fd(control, fd_in, fd_out, fd_hist, expected_size) < 0)) {
|
||||
clear_rulist(control);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* We can now safely delete sinfo and pthread data of all threads
|
||||
* created. */
|
||||
clear_rulist(control);
|
||||
|
||||
if (STDOUT && !TMP_OUTBUF) {
|
||||
if (unlikely(!dump_tmpoutfile(control, fd_out)))
|
||||
|
|
|
|||
6
runzip.c
6
runzip.c
|
|
@ -249,7 +249,7 @@ static i64 unzip_match(rzip_control *control, void *ss, i64 len, uint32 *cksum,
|
|||
return total;
|
||||
}
|
||||
|
||||
static void clear_rulist(rzip_control *control)
|
||||
void clear_rulist(rzip_control *control)
|
||||
{
|
||||
while (control->ruhead) {
|
||||
struct runzip_node *node = control->ruhead;
|
||||
|
|
@ -381,10 +381,6 @@ static i64 runzip_chunk(rzip_control *control, int fd_in, i64 expected_size, i64
|
|||
if (unlikely(close_stream_in(control, ss)))
|
||||
fatal("Failed to close stream!\n");
|
||||
|
||||
/* We can now safely delete sinfo and pthread data of all threads
|
||||
* created. */
|
||||
clear_rulist(control);
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue