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

* marshal.c (r_bytes0): check if source has enough data.

[ruby-dev:32054]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@13700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-10-15 00:58:09 +00:00
parent ddeb0a4183
commit d95e0da764
4 changed files with 30 additions and 5 deletions

View file

@ -1,3 +1,8 @@
Mon Oct 15 09:58:07 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* marshal.c (r_bytes0): check if source has enough data.
[ruby-dev:32054]
Mon Oct 15 01:15:09 2007 Tanaka Akira <akr@fsij.org>
* ext/socket/socket.c (s_accept_nonblock): make accepted fd

View file

@ -468,7 +468,7 @@ w_object(obj, arg, limit)
return;
}
if (ivtbl = rb_generic_ivar_table(obj)) {
if ((ivtbl = rb_generic_ivar_table(obj)) != 0) {
w_byte(TYPE_IVAR, arg);
}
if (obj == Qnil) {
@ -873,7 +873,7 @@ r_bytes0(len, arg)
if (len == 0) return rb_str_new(0, 0);
if (TYPE(arg->src) == T_STRING) {
if (RSTRING(arg->src)->len > arg->offset) {
if (RSTRING(arg->src)->len > arg->offset + len) {
str = rb_str_new(RSTRING(arg->src)->ptr+arg->offset, len);
arg->offset += len;
}

View file

@ -45,4 +45,24 @@ class TestMarshal < Test::Unit::TestCase
assert_equal(a, b)
}
end
class C
def initialize(str)
@str = str
end
def _dump(limit)
@str
end
def self._load(s)
new(s)
end
end
def test_too_long_string
(data = Marshal.dump(C.new("a")))[-2, 1] = "\003\377\377\377"
e = assert_raise(ArgumentError, "[ruby-dev:32054]") {
Marshal.load(data)
}
assert_equal("marshal data too short", e.message)
end
end

View file

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.8.6"
#define RUBY_RELEASE_DATE "2007-10-14"
#define RUBY_RELEASE_DATE "2007-10-15"
#define RUBY_VERSION_CODE 186
#define RUBY_RELEASE_CODE 20071014
#define RUBY_RELEASE_CODE 20071015
#define RUBY_PATCHLEVEL 5000
#define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 6
#define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 10
#define RUBY_RELEASE_DAY 14
#define RUBY_RELEASE_DAY 15
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];