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
ISC parser hangs forever on truncated maps (unterminated sub/stage block spins in _stage) #43
The ISC parser (src/interscript/isc.py) loops forever on a truncated/corrupted map instead of raising IscParseError. An unterminated sub { block inside stage main (with no closing braces for the map) spins in _stage/_block_items indefinitely at 100% CPU.
Found by the WO20 differential fuzz campaign (interscript/maps#284): 10 of 1600 cases hit this; every one was a truncation-style mutation.
Minimal repro (10 lines)
system "VAR:hin-Deva:Latn:hunterian-1872" {
metadata {
notes {
}
}
tests {
}
stage main {
sub {
}
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')"# never returns; 100% CPU
Fixed by #45 (branch wo20-fix-py off origin/main).
Red -> green evidence:
Pre-fix: the campaign's 10-line repro spins forever in _stage <- _block_items (faulthandler stack identical to the issue's; reproduction hung the test until a 25 s alarm kill).
Post-fix: IscParseError: hang.isc: line 10:4: Expected '}' but got '' - terminating, named, with a position pointer.
Root cause: the stage loop and the sequence/parallel rule loop broke only on }; the skip-line fallback makes no progress at EOF. Both now carry the standard EOF progress invariant (the _block_items guard), so the trailing _expect("}") names the failure.
Class closure: a committed sweep test parses every truncation of two verbatim corpus maps (2,414 prefixes) and requires a document or a named IscParseError - never a spin, never an accidental exception. Both repro shapes get dedicated regression tests.
Full suite green (99 passed, 1 xpassed); smoke corpus stays green; no accept-language change (valid-escape decode control test passes pre- and post-fix).
Activity
ronaldtse commentedon Nov 16, 2026
Fixed by #45 (branch
wo20-fix-pyofforigin/main).Red -> green evidence:
_stage<-_block_items(faulthandler stack identical to the issue's; reproduction hung the test until a 25 s alarm kill).IscParseError: hang.isc: line 10:4: Expected '}' but got ''- terminating, named, with a position pointer.}; the skip-line fallback makes no progress at EOF. Both now carry the standard EOF progress invariant (the_block_itemsguard), so the trailing_expect("}")names the failure.IscParseError- never a spin, never an accidental exception. Both repro shapes get dedicated regression tests.