Fix zero sized archive decompression.

This commit is contained in:
Con Kolivas 2018-05-17 15:06:31 +10:00
parent 95688b0833
commit 257186a865

View file

@ -382,9 +382,11 @@ i64 runzip_fd(rzip_control *control, int fd_in, int fd_out, int fd_hist, i64 exp
do {
u = runzip_chunk(control, fd_in, expected_size, total);
if (unlikely(u < 1)) {
print_err("Failed to runzip_chunk in runzip_fd\n");
return -1;
if (u < 1) {
if (u < 0 || total < expected_size) {
print_err("Failed to runzip_chunk in runzip_fd\n");
return -1;
}
}
total += u;
if (TMP_OUTBUF) {