-
Notifications
You must be signed in to change notification settings - Fork 185
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
Limit max encodings to 256 and raise error #3434
Limit max encodings to 256 and raise error #3434
Conversation
3126bf7
to
0da1996
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. I wonder if we exploit the max length now to simplify the handling of the encoding list, but it's okay to limit this PR to adding the new limit.
@@ -721,4 +721,25 @@ | |||
str.bytes.should == [0, 0x24] | |||
end | |||
end | |||
|
|||
describe "rb_define_dummy_encoding" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for writing new specs!
298709f
to
e93e6b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
But it seems one way to create new encoding is missing - Encoding#replicate
. It's implemented in org.truffleruby.core.encoding.EncodingNodes.EncodingReplicateNode
.
src/main/java/org/truffleruby/core/encoding/EncodingManager.java
Outdated
Show resolved
Hide resolved
0e65921
to
8a405cd
Compare
Could you please rebase on master to fix conflict in |
Co-authored-by: Jose Narvaez <[email protected]>
8a405cd
to
7408c34
Compare
Part of #3039.
This limits the max number of encodings when calling
rb_define_dummy_encoding
and raiseEncodingError
as per Ruby issue 18949. Tests inspired by this from MRI.