From ab9f55b03c670628d87323d636f86322147e5e40 Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 4 Oct 2026 18:13:16 +0000 Subject: The UTF-8 code had two NEVERs which didn't make sense. FossilOrigin-Name: 1be20afeb238bc7c9ca36b903378d6236af521855cfe76fe59ee39f22a7533ff --- src/lib/string.c | 4 ++-- tests/aplwc_utf8.c | 4 +++- tests/fuzz-crashes/2.fuzz | Bin 26 -> 0 bytes tests/fuzz-crashes/3.fuzz | 5 ----- tests/fuzz-crashes/4.fuzz | 4 ---- tests/fuzz-crashes/5.fuzz | Bin 38 -> 0 bytes tests/fuzz-crashes/Makefile.am | 1 - tools/check | 4 ++-- 8 files changed, 7 insertions(+), 15 deletions(-) delete mode 100644 tests/fuzz-crashes/2.fuzz delete mode 100644 tests/fuzz-crashes/3.fuzz delete mode 100644 tests/fuzz-crashes/4.fuzz delete mode 100644 tests/fuzz-crashes/5.fuzz diff --git a/src/lib/string.c b/src/lib/string.c index 0c01fca..469ef26 100644 --- a/src/lib/string.c +++ b/src/lib/string.c @@ -66,7 +66,7 @@ invalid: charcount++; switch(seqlen){ case 0: - if(NEVER(c == 0) || NEVER(c > 0x7F)) + if(NEVER(c > 0x7F)) goto invalid; break; case 1: @@ -78,7 +78,7 @@ invalid: goto invalid; break; case 3: - if((c < 0x010000) || NEVER(c > 0x10FFFF)) + if((c < 0x010000) || (c > 0x10FFFF)) goto invalid; break; } diff --git a/tests/aplwc_utf8.c b/tests/aplwc_utf8.c index 44dd85a..7d14778 100644 --- a/tests/aplwc_utf8.c +++ b/tests/aplwc_utf8.c @@ -28,6 +28,7 @@ uint8_t bad4[] = {0xc0,0x40,0}; uint8_t bad5[] = {0xe0,0x80,0x80,0}; uint8_t bad6[] = {0xc0,0}; uint8_t bad7[] = {0xF0,0x80,0x80,0x80,0}; +uint8_t bad8[] = {0xF7,0xBF,0xBF,0xBF,0}; uint8_t good1[] = {0x61,0x70,0x6c,0x77,0x63,0}; uint8_t good2[] = {0x41,0xe2,0x89,0xa2,0xce,0x91,0x2e,0}; @@ -65,7 +66,8 @@ main(void) bad4, bad5, bad6, - bad7 + bad7, + bad8 }; uint8_t *good_tests[] = { diff --git a/tests/fuzz-crashes/2.fuzz b/tests/fuzz-crashes/2.fuzz deleted file mode 100644 index bd8af68..0000000 Binary files a/tests/fuzz-crashes/2.fuzz and /dev/null differ diff --git a/tests/fuzz-crashes/3.fuzz b/tests/fuzz-crashes/3.fuzz deleted file mode 100644 index ed1bb89..0000000 --- a/tests/fuzz-crashes/3.fuzz +++ /dev/null @@ -1,5 +0,0 @@ -#0000%00000000 - -:m::00=00 :::::::::0::!<00= - -:m80ø÷¥ˆ‡ diff --git a/tests/fuzz-crashes/4.fuzz b/tests/fuzz-crashes/4.fuzz deleted file mode 100644 index 0ad1632..0000000 --- a/tests/fuzz-crashes/4.fuzz +++ /dev/null @@ -1,4 +0,0 @@ -#!000000000000H0 - -:exmbol ylu'''000000ñ±±±ñ±±±/00000ñ±±±÷±¶±' ->?>'s 00 diff --git a/tests/fuzz-crashes/5.fuzz b/tests/fuzz-crashes/5.fuzz deleted file mode 100644 index 0161596..0000000 Binary files a/tests/fuzz-crashes/5.fuzz and /dev/null differ diff --git a/tests/fuzz-crashes/Makefile.am b/tests/fuzz-crashes/Makefile.am index d332083..e69de29 100644 --- a/tests/fuzz-crashes/Makefile.am +++ b/tests/fuzz-crashes/Makefile.am @@ -1 +0,0 @@ -TEST_INPUTS += tests/fuzz-crashes/2.fuzz tests/fuzz-crashes/3.fuzz tests/fuzz-crashes/4.fuzz tests/fuzz-crashes/5.fuzz diff --git a/tools/check b/tools/check index 6e16098..08d9ad5 100755 --- a/tools/check +++ b/tools/check @@ -33,9 +33,9 @@ do exit 1 ;; esac - ../../configure --enable-maintainer-mode --enable-build-mode=$type CFLAGS="$CFLAGS -Wall -Wextra -Werror -std=c89 -pedantic" LDFLAGS="$LDFLAGS" $OTHER + ../../configure --enable-maintainer-mode --disable-shared --enable-build-mode=$type CFLAGS="$CFLAGS -Wall -Wextra -Werror -std=c89 -pedantic" LDFLAGS="$LDFLAGS" $OTHER make -j check - ../../configure --enable-maintainer-mode --enable-build-mode=$type CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" $OTHER + ../../configure --enable-maintainer-mode --disable-shared --enable-build-mode=$type CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" $OTHER cd .. done -- cgit v1.2.3