Skip to content

[P-C1] Parser: bare except clauses swallow all errors #1

Closed

Description

@godofecht

Description

In src/flow/parser.py (lines ~2027, 2047), the backtracking logic for generic types and struct literals uses bare except: clauses. These catch everything — including KeyboardInterrupt, SystemExit, MemoryError, and internal Python bugs.

If the parser has a genuine bug inside these blocks, it will be silently hidden, and the parser will misinterpret the input.

# Line 2027
except:
    # Restore state - this was probably a comparison
    self.lexer.pos = save_pos
    ...
    return Variable(name)

Impact

  • Internal bugs silently swallowed
  • Ctrl+C during parsing is caught and ignored
  • sys.exit() calls inside these blocks are prevented

Fix

Replace bare except: with except Exception: (or better, a specific parser exception type).

Audit ID: P-C1

Severity: Critical | Category: Compiler - parser.py

Activity

  1. godofecht commented on Feb 9, 2026

    @godofecht
    ContributorAuthor

    Fixed: bare except clauses replaced with except SyntaxError: in parser backtracking logic.

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

    bugcompilercriticalsecurity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions