aboutsummaryrefslogtreecommitdiffstats
path: root/variable.c
diff options
context:
space:
mode:
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/variable.c b/variable.c
index f219acd4ca..0f6fba032d 100644
--- a/variable.c
+++ b/variable.c
@@ -1173,6 +1173,10 @@ rb_ivar_set(VALUE obj, ID id, VALUE val)
iv_index_tbl->num_entries < (st_index_t)newsize) {
newsize = iv_index_tbl->num_entries;
}
+
+ /* never happens in practice: */
+ if (newsize > INT_MAX) rb_memerror();
+
if (RBASIC(obj)->flags & ROBJECT_EMBED) {
newptr = ALLOC_N(VALUE, newsize);
MEMCPY(newptr, ptr, VALUE, len);