Sincedac2b39405("compress: strictly check if stream finished on decompress") the gzip branch of decompressor_push() no longer loops "while (avail_in > 0)", but loops until inflate() can make no further progress, so that we can properly detect truncated streams and trailing garbage. This means inflate() may now be called with no input left. If a previous iteration happened to fill the output buffer exactly (avail_out == 0) while also consuming the last input byte (avail_in == 0), we go around once more, and inflate() then has nothing to do and returns Z_BUF_ERROR. This is documented zlib behaviour and not an error condition: it merely indicates that no progress was possible. However, we treated anything other than Z_OK/Z_STREAM_END as a corrupted stream and returned -EBADMSG, hence valid gzip data was refused whenever the input chunk boundaries happened to line up with the output buffer size in this way. Accept Z_BUF_ERROR if all input has been consumed, and let the existing avail_in/avail_out check that follows decide whether we are done with the current input, or whether the stream is truncated (in the size == 0 finalization case). If input is left, Z_BUF_ERROR still results in -EBADMSG, so that we never loop forever without making progress. Whether the boundary condition is hit depends on the data being decompressed and on how it is chunked. This showed up in CI here: https://github.com/systemd/systemd/actions/runs/38428217767/job/115403151687?pr=44163 Add a test that decompresses incompressible data split at every offset around COMPRESS_PIPE_BUFFER_SIZE, which reliably triggers the condition for gzip, and checks the other algorithms the same way for good measure. Follow-up for:dac2b39405(cherry picked from commit 4128feb9f29e01ccd1f6b7594acc4af579ba4534)
System and Service Manager
Details
Most documentation is available on systemd's website.
Assorted, older, general information about systemd can be found in the systemd Wiki.
Information about build requirements is provided in the README file.
Consult our NEWS file for information about what's new in the most recent systemd versions.
Please see the Code Map for information about this repository's layout and content.
Please see the Hacking guide for information on how to hack on systemd and test your modifications.
Please see our Contribution Guidelines for more information about filing GitHub Issues and posting GitHub Pull Requests.
When preparing patches for systemd, please follow our Coding Style Guidelines.
If you are looking for support, please contact our mailing list, join our IRC channel #systemd on libera.chat or Matrix channel
Stable branches with backported patches are available in the stable repo.
We have a security bug bounty program sponsored by the Sovereign Tech Fund hosted on YesWeHack
Repositories with distribution packages built from git main are available on OBS, and also repositories with packages built from the latest stable release
