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 SEGV if to_s method returns invalid object #836

Merged
merged 1 commit into from
Jan 23, 2023

Conversation

Watson1978
Copy link
Collaborator

Fix #834

In Ruby, it can easily override the to_s method and it may not return a string as expected (rarely).
This PR will check the object using StringValue whether it is a string object as expected after calling to_s.

ext/oj/oj.h Show resolved Hide resolved
@ohler55 ohler55 merged commit ec9f0d1 into ohler55:develop Jan 23, 2023
@Watson1978 Watson1978 deleted the safe-string-convert branch January 23, 2023 01:05
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.

Oj.mimic_JSON; JSON.dump(strange_object) cause SEGV
2 participants