Skip to content

Conversation

@Earlopain
Copy link
Collaborator

Integer#chr performs some validation that we don't want/need. Octal escapes can go above 255, where it will then raise trying to convert.

append_as_bytes actually allows to pass a number, so we can just skip that call. Although, on older rubies of course we still need to handle this in the polyfill. I don't really like using pack but don't know of another way to do so.

For the utf-8 escapes, this is not an issue. Invalid utf-8 in these is simply a syntax error.

`Integer#chr` performs some validation that we don't want/need. Octal escapes can go above 255, where it will then raise trying to convert.

`append_as_bytes` actually allows to pass a number, so we can just skip that call.
Although, on older rubies of course we still need to handle this in the polyfill.
I don't really like using `pack` but don't know of another way to do so.

For the utf-8 escapes, this is not an issue. Invalid utf-8 in these is simply a syntax error.
@Earlopain Earlopain force-pushed the parser-translator-octal-above-255 branch from c85ee99 to 161c606 Compare January 19, 2025 12:38
Copy link
Collaborator

@kddnewton kddnewton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think pack is the correct choice here

@kddnewton kddnewton merged commit dba87e0 into ruby:main Jan 19, 2025
57 checks passed
@Earlopain Earlopain deleted the parser-translator-octal-above-255 branch January 19, 2025 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants