summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-10 08:05:12 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-10 08:05:12 (GMT)
commitddf6eb40c725434fec5341e73777a0d59e135287 (patch)
treea6ae297022915ed0f0419c93f9a9a729687b1117 /variable.c
parent6a6362d633b7ef086523dacdd16f132739ad1d75 (diff)
variable.c: check index overflow
* variable.c (rb_ivar_set), vm_insnhelper.c (vm_setivar): check instance variable index overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/variable.c b/variable.c
index 0f6fba0..f2c582c 100644
--- a/variable.c
+++ b/variable.c
@@ -1153,6 +1153,7 @@ rb_ivar_set(VALUE obj, ID id, VALUE val)
ivar_extended = 0;
if (!st_lookup(iv_index_tbl, (st_data_t)id, &index)) {
index = iv_index_tbl->num_entries;
+ if (index >= INT_MAX) rb_raise(rb_eArgError, "too many instance variables");
st_add_direct(iv_index_tbl, (st_data_t)id, index);
ivar_extended = 1;
}