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

Oj.load second argument unconditionally assumes hash #254

Closed
enebo opened this issue Aug 25, 2015 · 6 comments
Closed

Oj.load second argument unconditionally assumes hash #254

enebo opened this issue Aug 25, 2015 · 6 comments

Comments

@enebo
Copy link

enebo commented Aug 25, 2015

ruby -roj -e 'Oj.load("sss", nil)'

Glancing at the code and this is just missing a Check_Type (or rb_check_type). Actually, the check is in other functions:

    if (T_HASH != rb_type(ropts)) {
        rb_raise(rb_eArgError, "options must be a hash.");
    }

load_file is also missing this check.

@ohler55
Copy link
Owner

ohler55 commented Aug 25, 2015

I'll get that fixed this week.

@enebo
Copy link
Author

enebo commented Aug 25, 2015

@ohler55 cool. although not a crasher (and not this reported issue) I think you also do some manual checks for T_FIXNUM and then follow up with a second Check_Type in a couple of places. I think with Check_Type second it is redundant (if it was before it might to_int -- I don't recall offhand).

@ohler55
Copy link
Owner

ohler55 commented Aug 25, 2015

I'll look for those. No need to do the check twice.

@ohler55
Copy link
Owner

ohler55 commented Aug 28, 2015

Please check the latest version on github. If it looks good I will make a release.

@enebo
Copy link
Author

enebo commented Aug 28, 2015

@ohler55 yeah I only noticed the two missing hash checks and have not seen any others.

@ohler55
Copy link
Owner

ohler55 commented Sep 3, 2015

Try it with the latest 2.12.13 release.

@ohler55 ohler55 closed this as completed Oct 3, 2015
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

No branches or pull requests

2 participants