Skip to content

Commit f5e7870

Browse files
author
Vicent Martí
authored
Merge pull request #35 from github/inspec-ivar-segv
Stop reading past the end of `ivptr` array
2 parents c91cb76 + a992d79 commit f5e7870

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

variable.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1605,7 +1605,7 @@ rb_ivar_count(VALUE obj)
16051605
switch (BUILTIN_TYPE(obj)) {
16061606
case T_OBJECT:
16071607
if ((tbl = ROBJECT_IV_INDEX_TBL(obj)) != 0) {
1608-
st_index_t i, count, num = tbl->num_entries;
1608+
st_index_t i, count, num = ROBJECT_NUMIV(obj);
16091609
const VALUE *const ivptr = ROBJECT_IVPTR(obj);
16101610
for (i = count = 0; i < num; ++i) {
16111611
if (ivptr[i] != Qundef) {

0 commit comments

Comments
 (0)