mirror of
https://github.com/GerbilSoft/zlib-ng.git
synced 2025-06-18 11:35:35 -04:00
Added unit test for inflate with Z_FINISH and no window.
This test decompresses a small git pack object with the text: "alone in the dark". By providing inflate with Z_FINISH, it should not use a sliding window according to zlib docs. We purposefully limit the read buffer size to trigger CHECK mode to bail early.
This commit is contained in:
parent
6592accb25
commit
0b3bb1d823
BIN
test/GH-1600/packobj.gz
Normal file
BIN
test/GH-1600/packobj.gz
Normal file
Binary file not shown.
@ -66,3 +66,11 @@ add_test(NAME GH-751
|
||||
-DTEST_NAME=GH-751-test-txt
|
||||
-DINPUT=${CMAKE_CURRENT_SOURCE_DIR}/GH-751/test.txt
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/compress-and-verify.cmake)
|
||||
|
||||
set(TEST_COMMAND ${MINIDEFLATE_COMMAND}
|
||||
"-d;-k;-s;4;${CMAKE_CURRENT_SOURCE_DIR}/GH-1600/packobj.gz")
|
||||
add_test(NAME GH-1600-no-window-check COMMAND ${TEST_COMMAND})
|
||||
|
||||
set(TEST_COMMAND ${MINIDEFLATE_COMMAND}
|
||||
"-d;-k;-s;4;-r;25;${CMAKE_CURRENT_SOURCE_DIR}/GH-1600/packobj.gz")
|
||||
add_test(NAME GH-1600-no-window-no-check COMMAND ${TEST_COMMAND})
|
||||
|
@ -167,6 +167,12 @@ void inflate_params(FILE *fin, FILE *fout, int32_t read_buf_size, int32_t write_
|
||||
|
||||
do {
|
||||
err = PREFIX(inflate)(&d_stream, flush);
|
||||
|
||||
/* Ignore Z_BUF_ERROR if we are finishing and read buffer size is
|
||||
* purposefully limited */
|
||||
if (flush == Z_FINISH && err == Z_BUF_ERROR && read_buf_size != BUFSIZE)
|
||||
err = Z_OK;
|
||||
|
||||
if (err == Z_STREAM_END) break;
|
||||
CHECK_ERR(err, "inflate");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user