Compiler throws exceptions during escape code handling #988

Open
opened 2026-01-29 15:18:29 +09:00 by spivee · 0 comments
Member

Normally when Sophia encounters a lexing error, like an unclosed string literal, it returns a well defined {error, [{err, ...}]} term. When you give it bad escape codes, including any of the following string literals, the compiler throws an exception, potentially crashing the entire erlang process. Sometimes the exception is something reasonable, like "** exception error: "Bad control sequence: \a"", but other times it is a ridiculous call stack from attempting to interpret random characters as hexadecimal digits. Examples of string literals that cause the compiler to crash:

  • "\a"
  • "\x"
  • "\x0"
  • "\xZZ"
Normally when Sophia encounters a lexing error, like an unclosed string literal, it returns a well defined `{error, [{err, ...}]}` term. When you give it bad escape codes, including any of the following string literals, the compiler throws an exception, potentially crashing the entire erlang process. Sometimes the exception is something reasonable, like "** exception error: "Bad control sequence: \\a"", but other times it is a ridiculous call stack from attempting to interpret random characters as hexadecimal digits. Examples of string literals that cause the compiler to crash: - "\a" - "\x" - "\x0" - "\xZZ"
Sign in to join this conversation.
No Milestone
No project
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: QPQ-AG/sophia#988
No description provided.