Skip to content
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

Fix "unexpected token" offset for Infinity #507

Merged
merged 1 commit into from
Dec 1, 2023

Conversation

jhawthorn
Copy link
Member

@jhawthorn jhawthorn commented Jan 12, 2023

Previously in the JSON::Ext parser, when we encountered an "Infinity" token (and we weren't allowing NaN/Infinity) we would try to display the "unexpected token" at the character before.

This was found by OSS-Fuzz due to its buffer underflow of exactly 1 byte. Due to low impact this isn't being tracked as a security issue.

@hsbt
Copy link
Member

hsbt commented Jan 23, 2023

@jhawthorn Thanks! Can you omit or pend with failing tests like RUBY_PLATFORM =~ /java/?

Previously in the JSON::Ext parser, when we encountered an "Infinity"
token (and weren't allowing NaN/Infinity) we would try to display the
"unexpected token" at the character before.
@hsbt hsbt merged commit fa4725f into ruby:master Dec 1, 2023
62 of 66 checks passed
@eregon
Copy link
Member

eregon commented Dec 1, 2023

RUBY_PLATFORM =~ /java/

Nit: it seems needlessly expensive to use a regexp for this.
Also RUBY_ENGINE seems much clearer: RUBY_ENGINE == "jruby".
TruffleRuby defines RUBY_PLATFORM like CRuby with the native platform, so RUBY_PLATFORM == "java" is the same as RUBY_ENGINE == "jruby" but less clear.

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.

3 participants