diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-30 17:35:56 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-11-30 17:35:56 +0000 |
commit | 4af525b16a91625b2c18edefe66bf835f67de95a (patch) | |
tree | e74967f005aed18b0c2cbde830dc0df3a28f49f4 /io.c | |
parent | 5925c930a8120ac5033f513a22a891b0329b29b8 (diff) |
merge revision(s) 51594: [Backport #11444]
* io.c (rb_io_each_codepoint): raise an exception at incomplete
character before EOF when conversion takes place. [Bug #11444]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@52804 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -3727,13 +3727,16 @@ rb_io_each_codepoint(VALUE io) } if (more_char(fptr) == MORE_CHAR_FINISHED) { clear_readconv(fptr); - /* ignore an incomplete character before EOF */ + if (!MBCLEN_CHARFOUND_P(r)) { + enc = fptr->encs.enc; + goto invalid; + } return io; } } if (MBCLEN_INVALID_P(r)) { - rb_raise(rb_eArgError, "invalid byte sequence in %s", - rb_enc_name(fptr->encs.enc)); + enc = fptr->encs.enc; + goto invalid; } n = MBCLEN_CHARFOUND_LEN(r); if (fptr->encs.enc) { |