1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

tkutil.c: fix out-of-bounds access

* ext/tk/tkutil/tkutil.c (cbsubst_table_setup): check array
  length not access out-of-bounds.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-06-01 01:55:10 +00:00
parent 847e919e81
commit 8e7393559f

View file

@ -1617,6 +1617,7 @@ cbsubst_table_setup(argc, argv, self)
for(idx = 0; idx < len; idx++) {
inf = RARRAY_PTR(proc_inf)[idx];
if (!RB_TYPE_P(inf, T_ARRAY)) continue;
if (RARRAY_LEN(inf) < 2) continue;
rb_hash_aset(subst_inf->proc,
(RB_TYPE_P(RARRAY_PTR(inf)[0], T_STRING)?
INT2FIX(*(RSTRING_PTR(RARRAY_PTR(inf)[0]))) :