ruby-changes:43091
From: naruse <ko1@a...>
Date: Wed, 25 May 2016 20:51:42 +0900 (JST)
Subject: [ruby-changes:43091] naruse:r55165 (trunk): * re.c (unescape_nonascii): scan hex up to only 3 characters.
naruse 2016-05-25 20:51:37 +0900 (Wed, 25 May 2016) New Revision: 55165 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55165 Log: * re.c (unescape_nonascii): scan hex up to only 3 characters. [Bug #12420] [Bug #12423] Modified files: trunk/ChangeLog trunk/re.c Index: ChangeLog =================================================================== --- ChangeLog (revision 55164) +++ ChangeLog (revision 55165) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed May 25 20:50:12 2016 NARUSE, Yui <naruse@r...> + + * re.c (unescape_nonascii): scan hex up to only 3 characters. + [Bug #12420] [Bug #12423] + Wed May 25 19:07:19 2016 Martin Duerst <duerst@i...> * enc/unicode.c: Handle DOTLESS_i by hand because it isn't involved in folding. Index: re.c =================================================================== --- re.c (revision 55164) +++ re.c (revision 55165) @@ -2492,8 +2492,8 @@ unescape_nonascii(const char *p, const c https://github.com/ruby/ruby/blob/trunk/re.c#L2492 case '1': case '2': case '3': case '4': case '5': case '6': case '7': /* \O, \OO, \OOO or backref */ { - size_t octlen; - if (ruby_scan_oct(p-1, end-(p-1), &octlen) <= 0177) { + size_t len = end-(p-1), octlen; + if (ruby_scan_oct(p-1, len < 3 ? len : 3, &octlen) <= 0177) { /* backref or 7bit octal. no need to unescape anyway. re-escaping may break backref */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/