tkutil.c: fix overrun
* ext/tk/tkutil/tkutil.c (cbsubst_initialize): fix out-of-bound access when no arguments given. `p Tk::Event.new` crashed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9cd35c22ab
commit
de3f0a42d8
@ -1,3 +1,8 @@
|
|||||||
|
Thu Apr 7 11:24:14 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/tk/tkutil/tkutil.c (cbsubst_initialize): fix out-of-bound
|
||||||
|
access when no arguments given. `p Tk::Event.new` crashed.
|
||||||
|
|
||||||
Fri Apr 1 01:26:00 2016 Benoit Daloze <eregontp@gmail.com>
|
Fri Apr 1 01:26:00 2016 Benoit Daloze <eregontp@gmail.com>
|
||||||
|
|
||||||
* ext/coverage/coverage.c: Fully reset coverage to not persist global state.
|
* ext/coverage/coverage.c: Fully reset coverage to not persist global state.
|
||||||
|
@ -1284,12 +1284,14 @@ cbsubst_initialize(argc, argv, self)
|
|||||||
|
|
||||||
inf = cbsubst_get_ptr(rb_obj_class(self));
|
inf = cbsubst_get_ptr(rb_obj_class(self));
|
||||||
|
|
||||||
|
if (argc > 0) {
|
||||||
idx = 0;
|
idx = 0;
|
||||||
for(iv_idx = 0; iv_idx < CBSUBST_TBL_MAX; iv_idx++) {
|
for (iv_idx = 0; iv_idx < CBSUBST_TBL_MAX; iv_idx++) {
|
||||||
if ( inf->ivar[iv_idx] == (ID) 0 ) continue;
|
if (inf->ivar[iv_idx] == (ID)0) continue;
|
||||||
rb_ivar_set(self, inf->ivar[iv_idx], argv[idx++]);
|
rb_ivar_set(self, inf->ivar[iv_idx], argv[idx++]);
|
||||||
if (idx >= argc) break;
|
if (idx >= argc) break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user