Skip to content

ISC parser hangs forever on truncated maps (unterminated sub/stage block spins in _stage) #43

Closed

Description

@ronaldtse

Summary

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_tree
isc_to_tree(open('map.isc', encoding='utf-8').read(), 'map.isc')
"
# never returns; 100% CPU

Observed vs expected

runtime behavior
py (origin/main c6ae457) hangs forever (_stage, isc.py:270 via _block_items:125)
ruby (origin/main 4c47eb5) clean Isc::ParseError reject
ts (origin/main b74cfda) clean IscParseError reject
rs (release 0.3.2) clean FAIL reject

faulthandler stack after 15s: isc.py:270 in _stage <- _block_items:125 <- parse:84 <- isc_to_tree:1056.

Expected: parse termination with a named IscParseError (unterminated block), like the other three runtimes.

Activity

  1. added
    crashRuntime crash (uncaught exception / abort) found by fuzzing
    hangInfinite loop / hang found by fuzzing
    on Nov 16, 2026
  2. ronaldtse commented on Nov 16, 2026

    @ronaldtse
    ContributorAuthor

    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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashRuntime crash (uncaught exception / abort) found by fuzzinghangInfinite loop / hang found by fuzzing

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions