1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/fiddle] StringValuePtr may change the val

https://github.com/ruby/fiddle/commit/bddca7c895
This commit is contained in:
Sutou Kouhei 2021-06-17 13:40:11 +09:00 committed by Nobuyoshi Nakada
parent 10e26cfa76
commit 9f86e50e1e
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -770,6 +770,7 @@ rb_fiddle_ptr_s_to_ptr(VALUE self, VALUE val)
}
else if (RTEST(rb_obj_is_kind_of(val, rb_cString))){
char *str = StringValuePtr(val);
wrap = val;
ptr = rb_fiddle_ptr_new(str, RSTRING_LEN(val), NULL);
}
else if ((vptr = rb_check_funcall(val, id_to_ptr, 0, 0)) != Qundef){