summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
authorNARUSE, Yui <naruse@airemix.jp>2023-01-20 17:01:47 +0900
committerNARUSE, Yui <naruse@airemix.jp>2023-01-20 17:01:47 +0900
commitc0df0a85dec77a09308caddb1e1efd4d38fbf7b8 (patch)
tree22b9b873051b85c2016c37c65132566fb9a9f179 /vm_insnhelper.c
parent373e62248c9dceb660e95f1cf05fa2a4a469cd64 (diff)
merge revision(s) ed6fbb79e19bf401db0e85447fee955fd10a25c7: [Backport #19339]
Fix crash when defining ivars on special constants [Bug #19339] --- test/ruby/test_variable.rb | 6 ++++++ vm_insnhelper.c | 5 +++++ 2 files changed, 11 insertions(+)
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index aa5e565f10..f9b91a0102 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1562,6 +1562,11 @@ vm_getinstancevariable(const rb_iseq_t *iseq, VALUE obj, ID id, IVC ic)
static inline void
vm_setinstancevariable(const rb_iseq_t *iseq, VALUE obj, ID id, VALUE val, IVC ic)
{
+ if (RB_SPECIAL_CONST_P(obj)) {
+ rb_error_frozen_object(obj);
+ return;
+ }
+
shape_id_t dest_shape_id;
attr_index_t index;
vm_ic_atomic_shape_and_index(ic, &dest_shape_id, &index);