Skip to content

Commit

Permalink
* array.c (rb_ary_subseq): need integer overflow check.
Browse files Browse the repository at this point in the history
	  [ruby-dev:31736]
	* array.c (rb_ary_splice): ditto.  [ruby-dev:31737]
	* array.c (rb_ary_fill): ditto.  [ruby-dev:31738]


git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_6@13399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
shyouhei committed Sep 7, 2007
1 parent 38197af commit d41ea7b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
Fri Sep 7 16:39:23 2007 Yukihiro Matsumoto <matz@ruby-lang.org>

* array.c (rb_ary_fill): need integer overflow check.
[ruby-dev:31738]
* array.c (rb_ary_subseq): need integer overflow check.
[ruby-dev:31736]

* array.c (rb_ary_splice): ditto. [ruby-dev:31737]

* array.c (rb_ary_fill): ditto. [ruby-dev:31738]

* string.c (rb_str_splice): integer overflow for length.
[ruby-dev:31739]
Expand Down
4 changes: 2 additions & 2 deletions array.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,7 @@ rb_ary_subseq(ary, beg, len)
if (beg > RARRAY(ary)->len) return Qnil;
if (beg < 0 || len < 0) return Qnil;

if (beg + len > RARRAY(ary)->len) {
if (RARRAY(ary)->len < len || RARRAY(ary)->len < beg + len) {
len = RARRAY(ary)->len - beg;
if (len < 0)
len = 0;
Expand Down Expand Up @@ -961,7 +961,7 @@ rb_ary_splice(ary, beg, len, rpl)
rb_raise(rb_eIndexError, "index %ld out of array", beg);
}
}
if (beg + len > RARRAY(ary)->len) {
if (RARRAY(ary)->len < len || RARRAY(ary)->len < beg + len) {
len = RARRAY(ary)->len - beg;
}

Expand Down
2 changes: 1 addition & 1 deletion version.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define RUBY_RELEASE_DATE "2007-09-07"
#define RUBY_VERSION_CODE 186
#define RUBY_RELEASE_CODE 20070907
#define RUBY_PATCHLEVEL 99
#define RUBY_PATCHLEVEL 100

#define RUBY_VERSION_MAJOR 1
#define RUBY_VERSION_MINOR 8
Expand Down

0 comments on commit d41ea7b

Please sign in to comment.