]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fix type mismatch errors in fuzzers. develop
authorMika T. Lindqvist <postmaster@raasu.org>
Fri, 19 Jun 2026 18:53:50 +0000 (21:53 +0300)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sat, 20 Jun 2026 21:31:04 +0000 (23:31 +0200)
test/fuzz/fuzzer_compress.c
test/fuzz/fuzzer_example_flush.c
test/fuzz/fuzzer_example_small.c

index a9de005a36ac2b80cff8ddbe2c8ef6958f32da02..a6481f52d59fab3834a7e3cf34e3fc6ad11c58f0 100644 (file)
@@ -7,7 +7,7 @@
 #endif
 
 static const uint8_t *data;
-static size_t dataLen;
+static z_uintmax_t dataLen;
 
 static void check_compress_level(uint8_t *compr, z_uintmax_t comprLen,
                                  uint8_t *uncompr, z_uintmax_t uncomprLen,
@@ -50,8 +50,8 @@ static void check_decompress(uint8_t *compr, z_uintmax_t comprLen) {
 
 int LLVMFuzzerTestOneInput(const uint8_t *d, size_t size) {
     /* compressBound does not provide enough space for low compression levels. */
-    z_size_t comprLen = 100 + 2 * PREFIX(compressBound)(size);
-    z_size_t uncomprLen = (z_size_t)size;
+    z_uintmax_t comprLen = 100 + 2 * PREFIX(compressBound)((z_uintmax_t)size);
+    z_uintmax_t uncomprLen = (z_uintmax_t)size;
     uint8_t *compr, *uncompr;
 
     /* Discard inputs larger than 1Mb. */
@@ -61,7 +61,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *d, size_t size) {
         return 0;
 
     data = d;
-    dataLen = size;
+    dataLen = (z_uintmax_t)size;
     compr = (uint8_t *)calloc(1, comprLen);
     uncompr = (uint8_t *)calloc(1, uncomprLen);
 
index 62788e37208c311c39e21b4d17ad9b77023e323b..3836e794fd9d79a4d75f239b13872be3d73cf09c 100644 (file)
@@ -90,7 +90,7 @@ void test_sync(unsigned char *compr, size_t comprLen, unsigned char *uncompr, si
 }
 
 int LLVMFuzzerTestOneInput(const uint8_t *d, size_t size) {
-    z_size_t comprLen = 100 + 2 * PREFIX(compressBound)(size);
+    z_size_t comprLen = 100 + 2 * PREFIX(compressBound)((z_uintmax_t)size);
     z_size_t uncomprLen = (z_size_t)size;
     uint8_t *compr, *uncompr;
 
index d1ace3b0a2de09b71c9314761a9a2c07e73f6694..7446555b0c2d98cc6ec2f87a368177858e1422d6 100644 (file)
@@ -90,7 +90,7 @@ void test_inflate(unsigned char *compr, size_t comprLen, unsigned char *uncompr,
 }
 
 int LLVMFuzzerTestOneInput(const uint8_t *d, size_t size) {
-    size_t comprLen = PREFIX(compressBound)(size);
+    size_t comprLen = PREFIX(compressBound)((z_uintmax_t)size);
     size_t uncomprLen = size;
     uint8_t *compr, *uncompr;