summaryrefslogtreecommitdiff
path: root/marshal.c
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-07 16:49:45 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-07 16:49:45 +0000
commite782b42f18f3ac7e5788c5be83048004ff51fa6f (patch)
treef19149e242f27702c8e4cb02f51cbee7b02308ee /marshal.c
parent4c0dddbfbd6565b1f5f308fec9ed0055f0bcdfb8 (diff)
merge revision(s) 13699:13704:
* marshal.c (r_bytes0): refined length check. [ruby-dev:32059] * 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_5@16901 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/marshal.c b/marshal.c
index b338c15e14..cccf26fd7b 100644
--- a/marshal.c
+++ b/marshal.c
@@ -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;
}