Skip to content

Handle error result from unescape_tokens in tokenizer #14587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 19, 2025

Conversation

lukaszsamson
Copy link
Contributor

I noticed this crash

** (MatchError) no match of right hand side value: {:error, {[line: 1, column: 22], ~c"invalid Unicode escape character, expected \\uHHHH or \\u{H*} where H is a hexadecimal digit. Syntax error after: ", ~c"\\u"}}
    (elixir 1.18.4) src/elixir_tokenizer.erl:929: :elixir_tokenizer.handle_dot/6

All other usages of unescape_tokens properly handle errors

@josevalim
Copy link
Member

Do you know which input can trigger this? If not, I can reverse engineer a test. :)

@lukaszsamson
Copy link
Contributor Author

Do you know which input can trigger this? If not, I can reverse engineer a test. :)

46.y .'9VQj}.{k*J\%yDHqULDXI!g5V"!qJWhV|U%"XJN\xgy(<=&|6^GDk.ui+zOO}\,mZ5QA%T]'BUP@Q}8:-yRNL7C\gG'

@josevalim
Copy link
Member

If you can push a test with a minimum string, that would be fantastic, otherwise I will do it later, thanks!

@sabiwara
Copy link
Contributor

sabiwara commented Jun 18, 2025

I think I got a minimum string:

iex> Code.string_to_quoted "a.'\\u'"
** (MatchError) no match of right hand side value: {:error, {[line: 1, column: 3], ~c"invalid Unicode escape character, expected \\uHHHH or \\u{H*} where H is a hexadecimal digit. Syntax error after: ", ~c"\\u"}}
    (elixir 1.18.4) src/elixir_tokenizer.erl:929: :elixir_tokenizer.handle_dot/6

@josevalim josevalim merged commit b2587e8 into elixir-lang:main Jun 19, 2025
13 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants