]> git.ipfire.org Git - thirdparty/zlib-ng.git/commit
Fix bi_valid handling in deflate_quick()
authorIlya Leoshkevich iii@linux.ibm.com <iii@linux.ibm.com>
Mon, 15 Mar 2021 19:15:47 +0000 (20:15 +0100)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Tue, 16 Mar 2021 11:21:30 +0000 (12:21 +0100)
commit04ae6d8b19ad32adf66138fb84c62fc7bf310334
treefe46bf2f2abfded4741d26eb8b83b02b8338c1eb
parent052b9fcb1b4df1321c6fbe5fccc895beeda3c903
Fix bi_valid handling in deflate_quick()

The attached test started failing after commit ad89d5131b29 ("Don't
write end of last block when returning finish_started."): either with
"bi_buf not flushed" message in debug builds, or by producing corrupted
output in release builds.

The problem is that we must not return finish_started when bi_buf is
not empty, because the bits there will be lost. Fix by checking that
bi_valid is not 0.
CMakeLists.txt
deflate_quick.c
test/deflate_quick_bi_valid.c [new file with mode: 0644]