diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-31 02:59:57 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-31 02:59:57 +0000 |
commit | 189febdf243244c963d5a370601eabd4423ac2f7 (patch) | |
tree | 99501ac9225787360959adfeceda8bf62f709ffc /pack.c | |
parent | d3bb9ea1128c1f98b3aede3228f77a4d79241382 (diff) | |
download | ruby-189febdf243244c963d5a370601eabd4423ac2f7.tar.gz |
* 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.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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[] = { |