diff options
author | Ilya Leoshkevich <iii@linux.ibm.com> | 2021-10-11 13:47:20 +0200 |
---|---|---|
committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2021-12-24 12:52:14 +0100 |
commit | b1f726ae45a1de8fc051e7ba374dc2996309a20c (patch) | |
tree | fcff05dbb6558c3c79f3d1ff1fb920c4779518e5 /test | |
parent | a38184edb50b6d0905413782fc615e6883dbaf1c (diff) |
IBM Z: Do not check inflateGetDictionary() with DFLTCC
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.
Diffstat (limited to 'test')
-rw-r--r-- | test/example.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/test/example.c b/test/example.c index d6cd4c9..c31d1cf 100644 --- a/test/example.c +++ b/test/example.c @@ -29,6 +29,9 @@ static const char hello[] = "hello, hello!"; static const char dictionary[] = "hello"; static unsigned long dictId = 0; /* Adler32 value of the dictionary */ +/* Maximum dictionary size, according to inflateGetDictionary() description. */ +#define MAX_DICTIONARY_SIZE 32768 + void test_compress (unsigned char *compr, z_size_t comprLen,unsigned char *uncompr, z_size_t uncomprLen); void test_gzio (const char *fname, unsigned char *uncompr, z_size_t uncomprLen); @@ -514,7 +517,7 @@ void test_dict_deflate(unsigned char *compr, size_t comprLen) { */ void test_dict_inflate(unsigned char *compr, size_t comprLen, unsigned char *uncompr, size_t uncomprLen) { int err; - uint8_t check_dictionary[10]; + uint8_t check_dictionary[MAX_DICTIONARY_SIZE]; uint32_t check_dictionary_len = 0; PREFIX3(stream) d_stream; /* decompression stream */ @@ -547,13 +550,17 @@ void test_dict_inflate(unsigned char *compr, size_t comprLen, unsigned char *unc err = PREFIX(inflateGetDictionary)(&d_stream, NULL, &check_dictionary_len); CHECK_ERR(err, "inflateGetDictionary"); +#ifndef S390_DFLTCC_INFLATE if (check_dictionary_len != sizeof(dictionary)) error("bad dictionary length\n"); +#endif err = PREFIX(inflateGetDictionary)(&d_stream, check_dictionary, &check_dictionary_len); CHECK_ERR(err, "inflateGetDictionary"); +#ifndef S390_DFLTCC_INFLATE if (memcmp(dictionary, check_dictionary, sizeof(dictionary)) != 0) error("bad dictionary\n"); +#endif err = PREFIX(inflateEnd)(&d_stream); CHECK_ERR(err, "inflateEnd"); |