mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
2 changed files with 12 additions and 5 deletions
|
@ -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>
|
||||
|
||||
* ext/coverage/coverage.c: Fully reset coverage to not persist global state.
|
||||
|
|
|
@ -1284,11 +1284,13 @@ cbsubst_initialize(argc, argv, self)
|
|||
|
||||
inf = cbsubst_get_ptr(rb_obj_class(self));
|
||||
|
||||
idx = 0;
|
||||
for(iv_idx = 0; iv_idx < CBSUBST_TBL_MAX; iv_idx++) {
|
||||
if ( inf->ivar[iv_idx] == (ID) 0 ) continue;
|
||||
rb_ivar_set(self, inf->ivar[iv_idx], argv[idx++]);
|
||||
if (idx >= argc) break;
|
||||
if (argc > 0) {
|
||||
idx = 0;
|
||||
for (iv_idx = 0; iv_idx < CBSUBST_TBL_MAX; iv_idx++) {
|
||||
if (inf->ivar[iv_idx] == (ID)0) continue;
|
||||
rb_ivar_set(self, inf->ivar[iv_idx], argv[idx++]);
|
||||
if (idx >= argc) break;
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
|
|
Loading…
Add table
Reference in a new issue