diff options
| author | dearblue <[email protected]> | 2021-08-13 15:04:19 +0900 |
|---|---|---|
| committer | dearblue <[email protected]> | 2021-08-13 15:04:19 +0900 |
| commit | 01da5e13920989b6c7ab97900659f570bdcb78f2 (patch) | |
| tree | 5e0b9eea1c7ab20c8e018b54dce9f6f4af6ff36e /mrbgems | |
| parent | 9e74aad43c8a7652c3cc0ffdc282c66ea866999b (diff) | |
| download | mruby-01da5e13920989b6c7ab97900659f570bdcb78f2.tar.gz mruby-01da5e13920989b6c7ab97900659f570bdcb78f2.zip | |
Check the class with `I` specifier of `mrb_get_args()`
Previously, the `I` specifier only checked if the object was `MRB_TT_ISTRUCT`.
So it was at risk of getting pointers to different C structs if multiple classes were to use the `MRB_TT_ISTRUCT` instance.
Change this behavior and change the C argument corresponding to the `I` specifier to `(void *, struct RClass)`.
This change is not compatible with the previous mruby.
Please note that if the user uses the previous specifications, `SIGSEGV` may occur or the machine stack may be destroyed.
resolve #5527
Diffstat (limited to 'mrbgems')
| -rw-r--r-- | mrbgems/mruby-inline-struct/test/inline.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mrbgems/mruby-inline-struct/test/inline.c b/mrbgems/mruby-inline-struct/test/inline.c index 6764b1af4..16d16fa4d 100644 --- a/mrbgems/mruby-inline-struct/test/inline.c +++ b/mrbgems/mruby-inline-struct/test/inline.c @@ -57,7 +57,8 @@ static mrb_value istruct_test_test_receive_direct(mrb_state *mrb, mrb_value self) { char *ptr; - mrb_get_args(mrb, "I", &ptr); + struct RClass *klass = mrb_class_get(mrb, "InlineStructTest"); + mrb_get_args(mrb, "I", &ptr, klass); return mrb_bool_value(ptr[0] == 's'); } |
