You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Malformed \u escapes raise raw ValueError instead of IscParseError (107 fuzz cases) #44
Malformed or grammar-unsupported \u/\U escapes inside string literals make the ISC parser raise a raw Python ValueError (invalid literal for int() with base 16: ...) instead of a clean IscParseError. The ISC grammar (grammar/isc.parg esc_uni4/esc_uni) defines \uXXXX (exactly 4 hex) and \U with 4-8 hex; anything else must be a parse error.
Found by the WO20 differential fuzz campaign (interscript/maps#284): 107 of 1600 cases hit this family, making it the single largest crash class.
Minimal repro (90 bytes)
system "T:fz-em6:1" {
stage main {
sequence {
sub "\u{1F600}" "X"
}
}
}
python3 -c "import sys; sys.path.insert(0, 'src')from interscript.isc import isc_to_treeisc_to_tree(open('map.isc', encoding='utf-8').read(), 'map.isc')"# ValueError: invalid literal for int() with base 16: '{1F6'
Observed vs expected
input
py
ruby
ts
rs
"\u{1F600}" (braced form)
ValueError (raw)
ParseError
IscParseError
clean FAIL
"\uZZZZ" (bad hex, even inside metadata note text)
ValueError: invalid literal for int() with base 16: 'ZZZZ'
ParseError
IscParseError
clean FAIL
"\u00E" (short hex)
same class
ParseError
IscParseError
clean FAIL
Note the \uZZZZ case fires from a metadata note string — the escape scanner runs over free text too, so malformed escapes anywhere in a document crash the parse.
Expected: every malformed/unsupported escape raises IscParseError with a line/col pointer, like the other three runtimes.
Fixed by #45 (branch wo20-fix-py off origin/main).
Red -> green evidence:
Pre-fix: the issue's 90-byte repro raises the raw ValueError: invalid literal for int() with base 16: '{1F6' (all 3 matrix rows leaked it; note text included, since the notes list shares _string_literal).
Post-fix: IscParseError: escape.isc: line 4:12: Invalid \u escape: expected exactly 4 hexadecimal digits - the pointer sits at the escape's backslash. Ruby/ts/rs parity: \u{...}, \uZZZZ, \u00E all reject named now.
The matrix tests cover short hex, non-hex head/tail, the braced form, end-of-string and end-of-file cuts, and the note-text placement; a control test pins that valid \uXXXX decoding is byte-identical to pre-fix.
\U is deliberately untouched: the ts reference documents (actions.ts) that the hand parser renders it as literal U + raw digits while ruby's artifact parser decodes both spellings - aligning the runtimes is an owner decision, so this fix keeps py on the ts-parity behavior and adds a test pinning it (malformed \U never crashes, never raises).
Full suite green (99 passed, 1 xpassed). In the WO20 smoke corpus this fix flips 7 cases from known to full four-runtime agree (all seven were py CRASH/ValueError rows); findings stay 0 and the smoke corpus is untouched.
Activity
ronaldtse commentedon Nov 16, 2026
Fixed by #45 (branch
wo20-fix-pyofforigin/main).Red -> green evidence:
ValueError: invalid literal for int() with base 16: '{1F6'(all 3 matrix rows leaked it; note text included, since the notes list shares_string_literal).IscParseError: escape.isc: line 4:12: Invalid \u escape: expected exactly 4 hexadecimal digits- the pointer sits at the escape's backslash. Ruby/ts/rs parity:\u{...},\uZZZZ,\u00Eall reject named now.\uXXXXdecoding is byte-identical to pre-fix.\Uis deliberately untouched: the ts reference documents (actions.ts) that the hand parser renders it as literalU+ raw digits while ruby's artifact parser decodes both spellings - aligning the runtimes is an owner decision, so this fix keeps py on the ts-parity behavior and adds a test pinning it (malformed\Unever crashes, never raises).knownto full four-runtimeagree(all seven were pyCRASH/ValueErrorrows); findings stay 0 and the smoke corpus is untouched.