diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-21 03:15:57 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-21 03:15:57 +0000 |
commit | c8d66b5d829f8ba029ae967cf67982d754e30591 (patch) | |
tree | 89c8a73a702739d419e34a69fc14b99644afa4b6 /ext/stringio/stringio.c | |
parent | 853ab8662f4cdde16f28ba775acf1be0725a25f4 (diff) |
stringio.c: check range
* ext/stringio/stringio.c (strio_ungetc): raise RangeError instead
of TypeError at too big value, as well as IO#ungetc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/stringio/stringio.c')
-rw-r--r-- | ext/stringio/stringio.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c index d6833976af..08524b4d9e 100644 --- a/ext/stringio/stringio.c +++ b/ext/stringio/stringio.c @@ -766,8 +766,8 @@ strio_ungetc(VALUE self, VALUE c) check_modifiable(ptr); if (NIL_P(c)) return Qnil; - if (FIXNUM_P(c)) { - int len, cc = FIX2INT(c); + if (RB_INTEGER_TYPE_P(c)) { + int len, cc = NUM2INT(c); char buf[16]; enc = rb_enc_get(ptr->string); |