From: Eric Biggers Date: Sun, 11 Sep 2022 17:34:12 +0000 (-0500) Subject: tools/afl-fuzz: fix ctype calculation X-Git-Tag: v1.13.6~3 X-Git-Url: https://wimlib.net/git/?a=commitdiff_plain;h=8d7a09b59624b60f492fcd4727a16a6b5a5deaef;p=wimlib tools/afl-fuzz: fix ctype calculation --- diff --git a/tools/afl-fuzz/compress/fuzz.c b/tools/afl-fuzz/compress/fuzz.c index ccda14b3..4c911725 100644 --- a/tools/afl-fuzz/compress/fuzz.c +++ b/tools/afl-fuzz/compress/fuzz.c @@ -30,7 +30,7 @@ int main(int argc, char *argv[]) assert(ret == 1); ret = read(fd, &level, 1); assert(ret == 1); - ctype = 1 + ((ctype - 1) % 3); /* 1-3 */ + ctype = 1 + ((uint8_t)(ctype - 1) % 3); /* 1-3 */ level = 1 + (level % 100); /* 1-100 */ usize = stbuf.st_size - 2; diff --git a/tools/afl-fuzz/decompress/fuzz.c b/tools/afl-fuzz/decompress/fuzz.c index 546a695e..b3d4b90c 100644 --- a/tools/afl-fuzz/decompress/fuzz.c +++ b/tools/afl-fuzz/decompress/fuzz.c @@ -25,7 +25,7 @@ int main(int argc, char *argv[]) return 0; ret = read(fd, &ctype, 1); assert(ret == 1); - ctype = 1 + ((ctype - 1) % 3); /* 1-3 */ + ctype = 1 + ((uint8_t)(ctype - 1) % 3); /* 1-3 */ csize = stbuf.st_size - 1; uspace = csize * 8;