wget-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

wget2 | Fixed error log for non-fatal inflate() return code Z_BUF_ERROR


From: Michael Roosz
Subject: wget2 | Fixed error log for non-fatal inflate() return code Z_BUF_ERROR (!481)
Date: Thu, 24 Dec 2020 10:31:44 +0000


Michael Roosz created a merge request: 
https://gitlab.com/gnuwget/wget2/-/merge_requests/481

Project:Branches: michaelroosz/wget2:fix-gzip-decompress-error-log to 
gnuwget/wget2:master
Author:    Michael Roosz



This MR fixes logs of the kind
`Failed to uncompress gzip stream (-5)`

`Z_BUF_ERROR` is a non-fatal return code of inflate() and indicates that input 
and output is empty (size 0).

We already have
`       if (!srclen) {
                // special case to avoid decompress errors
                if (dc->sink)
                        dc->sink(dc->context, "", 0);

                return 0;
        }`
to avoid this case (srclen = 0).

However, during the
`       do {
                strm->next_out = (unsigned char *) dst;
                strm->avail_out = sizeof(dst);

                status = inflate(strm, Z_SYNC_FLUSH);
                if ((status == Z_OK || status == Z_STREAM_END) && 
strm->avail_out < sizeof(dst)) {
                        if (dc->sink)
                                dc->sink(dc->context, dst, sizeof(dst) - 
strm->avail_out);
                }
        } while (status == Z_OK && !strm->avail_out);`
loop, inflate() may encounter a sitation where all input has been read, but no 
output can be returned and thus will return `Z_BUF_ERROR`.

### Approver's checklist:

* [ ] The author has submitted the FSF Copyright Assignment and is listed in 
AUTHORS
* [ ] There is a test suite reasonably covering new functionality or 
modifications
* [ ] Function naming, parameters, return values, types, etc., are consistent 
with existing code
* [ ] This feature/change has adequate documentation added (if appropriate)
* [ ] No obvious mistakes / misspelling in the code

-- 
Reply to this email directly or view it on GitLab: 
https://gitlab.com/gnuwget/wget2/-/merge_requests/481
You're receiving this email because of your account on gitlab.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]