[ruby-cvs:64244] rhe:r57078 (trunk): encoding.c: handle needmore error from rb_enc_precise_mbclen()

rhe at ruby-lang.org rhe at ruby-lang.org
Wed Dec 14 21:32:42 JST 2016


rhe	2016-12-14 21:32:42 +0900 (Wed, 14 Dec 2016)

  New Revision: 57078

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57078

  Log:
    encoding.c: handle needmore error from rb_enc_precise_mbclen()
    
    rb_enc_ascget() erroneously reports success even if the given byte
    sequence is incomplete, for non-ASCII compatible encoding strings.
    
    rb_enc_precise_mbclen() may return a negative value on error, and thus
    rb_enc_ascget() must not store the return value in 'unsigned int';
    otherwise the subsequent MBCLEN_CHARFOUND_P() check won't catch the
    error.  [ruby-core:78646] [Bug #13034]

  Modified files:
    trunk/encoding.c
    trunk/test/ruby/test_regexp.rb


More information about the ruby-cvs mailing list