Age | Commit message (Collapse) | Author |
|
The zlib manual does not specify a strict contract for
inflateGetDictionary(), it merely says that it "Returns the sliding
dictionary being maintained by inflate", which is an implementation
detail. IBM Z inflate's behavior differs from that of software, and
may change in the future to boot.
|
|
|
|
in example.
|
|
|
|
|
|
|
|
example.c:920:16: warning: dereference of possibly-NULL ‘head’ [CWE-690] [-Wanalyzer-possible-null-dereference]
920 | head->text = 1;
| ~~~~~~~~~~~^~~
‘test_deflate_set_header’: event 1
|
| 906 | PREFIX(gz_header) *head = calloc(1, sizeof(PREFIX(gz_header)));
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | |
| | (1) this call could return NULL
|
|
* Reintroduce support for ZLIB_CONST in compat mode.
|
|
zlib-ng already counts on inttypes.h and stdint.h, so use those to avoid
printf-related warnings by casting integer fields whose size may vary to
uint64_t and printing them that way.
|
|
zlib-ng.h:1726:10: note: expected ‘const uint8_t * {aka const unsigned char *}’ but argument is of type ‘const char *’
|
|
example.c(199,57): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
example.c:207:32: warning: comparison between signed and unsigned integer expressions
|
|
stream.
|
|
CID 293478 (#1 of 1): Wrong size argument (SIZEOF_MISMATCH)
suspicious_sizeof: Passing argument 1UL to function calloc that returns a pointer of type zng_gz_header * is suspicious because a multiple of sizeof (zng_gz_header) /*80*/ is expected.
|
|
|
|
example.c:84:14: warning: variable ‘read’ set but not used [-Wunused-but-set-variable]
int err, read;
example.c:198:5: warning: Value stored to 'read' is never read [deadcode.DeadStores]
read = PREFIX(gzfread)(uncompr, uncomprLen, 1, file);
|
|
|
|
|
|
|
|
|
|
indent, initial function brace on the same line as definition, removed extraneous spaces and new lines.
|
|
inflateSync() is used to skip invalid deflate data, which means
that the check value that was being computed is no longer useful.
This commit turns off the check value computation, and furthermore
allows a successful return if the compressed data terminated in a
graceful manner. This commit also fixes a bug in the case that
inflateSync() is used before a header is ever processed. In that
case, there is no knowledge of a trailer, so the remainder is
treated as raw.
|
|
called. #438
|
|
|
|
copy stuct.
Found by msan.
|
|
|
|
|
|
These functions allow zlib-ng callers to modify and query the
compression parameters in a future-proof way. When the caller requests a
parameter, which is not supported by the current zlib-ng version, this
situation is detected and reported to the caller. The caller may modify
or query multiple parameters at once. Currently only "level" and
"strategy" parameters are supported. It is planned to add a
"reproducible" parameter, which would affect whether IBM Z DEFLATE
CONVERSION CALL is used.
Passing enum and void * buffer was chosen over passing strings, because
of simplicity for the caller. If strings were used, C callers would have
to call snprintf() and strtoul() for setting and getting integer-valued
parameters respectively, which is quite tedious.
Bulk updates were chosen over updating individual parameters separately,
because it might make sense to apply some parameters atomically, e.g.
level and strategy.
The new functions are defined only for zlib-ng, but not compat zlib.
|
|
Change CMakeLists.txt so that if WITH_GZFILEOP is OFF, gz* sources are still compiled against the tests which need them.
Remove duplicate gz functions from test code.
Always compile with gz functions when zlib tests enabled in makefile.
|
|
* ptrdiff_t check always failed because of unused parameter
* sizeof(void *) check always failed because of double semicolon
* Sign issue in nice_match assignment
* dist parameter of set_bytes may be unused
* Parameters of main may be unused in test/example.c
* snprintf requires a _POSIX_C_SOURCE #define in test/minigzip.c,
because a _POSIX_SOURCE #define is present
|
|
to avoid a GCC 8 warning:
test/example.c:465:48: warning: argument to ‘sizeof’ in ‘strncpy’ call is the same expression as the source; did you mean to use the size of the destination? [-Wsizeof-pointer-memaccess]
strncpy((char*)uncompr, garbage_str, sizeof(garbage_str));
|
|
With this patch we have a clean run of make test on aarch64 when zlib-ng is
configured with --with-msan --with-fuzzers.
|
|
Before this patch
cmake -DWITH_SANITIZERS=1
make
make test
used to fail with:
Running tests...
Test project /home/hansr/github/zlib/zlib-ng
Start 1: example
1/2 Test #1: example ..........................***Failed 0.14 sec
Start 2: example64
2/2 Test #2: example64 ........................***Failed 0.13 sec
==11605==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x62e000000595,0x62e0000053b5) and [0x62e000000400, 0x62e000005220) overlap
#0 0x7fab3bcc9662 in __asan_memcpy (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x8c662)
#1 0x40f936 in memcpy /usr/include/x86_64-linux-gnu/bits/string3.h:53
#2 0x40f936 in read_buf /home/spop/s/zlib-ng/deflate.c:1122
#3 0x410458 in deflate_stored /home/spop/s/zlib-ng/deflate.c:1394
#4 0x4133d7 in zng_deflate /home/spop/s/zlib-ng/deflate.c:945
#5 0x402253 in test_large_deflate /home/spop/s/zlib-ng/test/example.c:275
#6 0x4014e8 in main /home/spop/s/zlib-ng/test/example.c:536
#7 0x7fab3b89382f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#8 0x4018e8 in _start (/work/spop/zlib-ng/example+0x4018e8)
0x62e000000595 is located 405 bytes inside of 40000-byte region [0x62e000000400,0x62e00000a040)
allocated by thread T0 here:
#0 0x7fab3bcd579a in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9879a)
#1 0x40147a in main /home/spop/s/zlib-ng/test/example.c:516
0x62e000000400 is located 0 bytes inside of 40000-byte region [0x62e000000400,0x62e00000a040)
allocated by thread T0 here:
#0 0x7fab3bcd579a in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x9879a)
#1 0x40147a in main /home/spop/s/zlib-ng/test/example.c:516
SUMMARY: AddressSanitizer: memcpy-param-overlap ??:0 __asan_memcpy
==11605==ABORTING
fix bug #183 following recommendations of Mika Lindqvist
> the problem is in line c_stream.avail_in = (unsigned int)comprLen/2;
> which feeds it too much data ... it should cap it to
> c_stream.next_out - compr instead.
|
|
* move definition of z_size_t to zbuild.h
|
|
* zconf.h.in wasn't including Windows.h, that is correct header to include definitions from BaseTsd.h, and such missing required type definition for ssize_t when compiling using MS Visual C++
* Various places need implicit casting to z_size_t to get around compatibility issues, this will truncate the result when ZLIB_COMPAT is defined, calling code should check for truncation.
* Add ZLIB_COMPAT flag to nmake Makefile and use it to determine correct
filenames instead of WITH_GZFILEOP
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* Change 'uch' to 'unsigned char'
* Change 'Byte' to 'unsigned char'
|
|
|
|
Signed-off-by: Daniel Axtens <dja@axtens.net>
Conflicts:
adler32.c
compress.c
deflate.c
inflate.c
match.c
test/example.c
uncompr.c
zlib.h
|
|
Signed-off-by: Daniel Axtens <dja@axtens.net>
Conflicts:
arch/x86/crc_folding.c
crc32.c
|
|
Make compiling without gzip file operation support the default
(define WITH_GZFILEOP or use --zlib-compat to enable them).
Add initial support for compiling in a zlib-compatible mode, this currently only
enables gzip file operations and sets the ZLIB_COMPAT flag.
Conflicts:
test/minigzip.c
|
|
|
|
Only internal functions, no exported functions in this commit.
|
|
And a few Bytef leftovers from test/example.c
|
|
-Removing usage of OF() definition
|