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");
|
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;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We can now safely delete sinfo and pthread data of all threads
|
||||||
|
* created. */
|
||||||
|
clear_rulist(control);
|
||||||
|
|
||||||
if (STDOUT && !TMP_OUTBUF) {
|
if (STDOUT && !TMP_OUTBUF) {
|
||||||
if (unlikely(!dump_tmpoutfile(control, fd_out)))
|
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;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void clear_rulist(rzip_control *control)
|
void clear_rulist(rzip_control *control)
|
||||||
{
|
{
|
||||||
while (control->ruhead) {
|
while (control->ruhead) {
|
||||||
struct runzip_node *node = 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)))
|
if (unlikely(close_stream_in(control, ss)))
|
||||||
fatal("Failed to close stream!\n");
|
fatal("Failed to close stream!\n");
|
||||||
|
|
||||||
/* We can now safely delete sinfo and pthread data of all threads
|
|
||||||
* created. */
|
|
||||||
clear_rulist(control);
|
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
1
runzip.h
1
runzip.h
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
#include "lrzip_private.h"
|
#include "lrzip_private.h"
|
||||||
|
|
||||||
|
void clear_rulist(rzip_control *control);
|
||||||
i64 runzip_fd(rzip_control *control, int fd_in, int fd_out, int fd_hist, i64 expected_size);
|
i64 runzip_fd(rzip_control *control, int fd_in, int fd_out, int fd_hist, i64 expected_size);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue