summaryrefslogtreecommitdiff
path: root/pack.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-31 02:59:57 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-03-31 02:59:57 +0000
commit189febdf243244c963d5a370601eabd4423ac2f7 (patch)
tree99501ac9225787360959adfeceda8bf62f709ffc /pack.c
parentd3bb9ea1128c1f98b3aede3228f77a4d79241382 (diff)
* pack.c (pack_pack): raises RangeError if uv is out of UTF8 value
range. [ruby-dev:23281] * io.c (rb_io_binmode): stdio buffer should be empty when calling IO#binmode. [ruby-talk:96155] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'pack.c')
-rw-r--r--pack.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/pack.c b/pack.c
index 9680b0fd7f..f011a1f2c4 100644
--- a/pack.c
+++ b/pack.c
@@ -866,8 +866,12 @@ pack_pack(ary, fmt)
int le;
from = NEXTFROM;
+ from = rb_to_int(from);
l = num2i32(from);
le = uv_to_utf8(buf, l);
+ if (TYPE(from) == T_BIGNUM) {
+ rb_raise(rb_eRangeError, "pack(U): value out of range");
+ }
rb_str_buf_cat(res, (char*)buf, le);
}
break;
@@ -2024,7 +2028,7 @@ uv_to_utf8(buf, uv)
buf[5] = (uv&0x3f)|0x80;
return 6;
}
- rb_raise(rb_eArgError, "pack(U): value out of range");
+ rb_raise(rb_eRangeError, "pack(U): value out of range");
}
static const long utf8_limits[] = {