20 Commits
Author SHA1 Message Date
andrew 08b864d31b Reject invalid UTF-16 surrogate pairs and lone low surrogates for clarity
CI / build (-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++, clang-arm64, ubuntu-latest-arm64, true) (push) Successful in 54s
CI / pre-commit (push) Successful in 53s
CI / build (-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++, gcc-arm64, ubuntu-latest-arm64, false) (push) Successful in 50s
CI / build (-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++, clang-amd64, ubuntu-latest-amd64, true) (push) Successful in 1m32s
CI / build (-DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++, gcc-amd64, ubuntu-latest-amd64, false) (push) Successful in 1m24s
The string unescape logic treated any code unit in the surrogate range

(0xD800-0xDFFF) as the start of a surrogate pair. The concrete example

from issue #39 (\uDC00\uDC00) was already rejected by the existing

0x10FFFF bounds check, but the check was misleading and would accept a

lone low surrogate as a regular BMP code point if the second surrogate

happened to be in a narrower range. Clean this up so the intent is

obvious.

Changes in src/parser3.h:

- Fast path (n_string2): only treat high surrogates (0xD800-0xDBFF) as

the start of a surrogate pair, and explicitly reject lone low surrogates

(0xDC00-0xDFFF).

- Slow path (t_hex2): same high-surrogate check, with explicit rejection

of lone low surrogates.

The t_hex3 path already validates that the second code unit is a low

surrogate (0xDC00-0xDFFF), so no change is needed there.

Also commit the current fuzzer corpus.

Closes #39
2026-06-29 13:37:58 -04:00
andrew 8a1a922353 Add more coverage
Collected in trampoline fallback mode
2026-06-15 00:45:17 -04:00
andrew ceaadfb750 Add deep nested-array fuzz seed
Seeds the n_value<->n_array2 recursion that overflows the C stack in the
no-musttail fallback build (a good mutation seed once stackSize is raised
past the harness default of 1024).
2026-06-15 00:42:45 -04:00
andrew 470564a5df Improve coverage 2026-06-14 18:03:30 -04:00
andrew d8c9491eb3 Add fuzz test that finds previously missed coverage 2026-06-14 16:50:36 -04:00
andrew 0b24636c4f Update corpus 2025-08-04 14:42:50 -04:00
andrew 89211753e2 Add to corpus 2025-06-24 15:58:58 -04:00
andrew 95250d1668 Improve fuzz testing to find string scan bug 2025-06-22 23:00:34 -04:00
andrew 7806f6420f Add to corpus 2025-06-21 15:56:42 -04:00
andrew b28251c8b1 Add to corpus 2025-06-04 14:19:53 -04:00
andrew f519d3ce29 Add to corpus 2025-05-24 18:20:35 -04:00
andrew 18748483b2 Add to corpus 2025-05-22 15:51:51 -04:00
andrew 3682bea38a Add to corpus 2025-05-22 13:17:38 -04:00
andrew 96ef50d52f Add to corpus 2025-05-21 17:00:05 -04:00
andrew 45029e7dfa Add to corpus 2025-05-21 16:48:01 -04:00
andrew c79b19b24f Add to corpus 2025-05-20 11:56:25 -04:00
andrew 2b604a4f89 Add to corpus 2025-05-19 16:19:21 -04:00
andrew 2cb9bc8ad2 Add to corpus 2025-05-19 15:13:55 -04:00
andrew 452bbd3d9c More corpus 2025-05-18 17:21:13 -04:00
andrew 0a81c27155 Add corpus 2025-05-18 14:40:50 -04:00