-
Notifications
You must be signed in to change notification settings - Fork 781
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
mrb_string_value_cstr crashes if not given a string #2847
Comments
You should create a PR. I agree that However there's something else: Lines 628 to 641 in e344c6a
https://github.com/ruby/ruby/blob/a02a3f46496210ca401fd74585993c8754cbe91c/string.c#L1087-L1091 |
Sounds good. I'm heading to work, I'll make the PR when I get back. |
mrb_string_value_cstr
does horrible things if given an argument that isn't actually a string (well, it tends to crash, anyway). That's all fine and well, since in C you should know what you're doing with your pointers. However,mrb_string_value_ptr
avoids this by callingmrb_str_to_str
on its argument. I'm just wondering if there's a reason that they behave differently. (Until now, I thought the _cstr version just stopped at the first null character, and _ptr was more suited to arbitrary char buffers. It wasn't clear to me that one is more type sensitive.)I didn't see any issues/discussions on this yet. Maybe I'm the only one that's confused... O_o
The text was updated successfully, but these errors were encountered: