ruby-changes:13779
From: matz <ko1@a...>
Date: Fri, 30 Oct 2009 18:58:41 +0900 (JST)
Subject: [ruby-changes:13779] Ruby:r25576 (trunk): * string.c (trnext): detect empty range and raise exception.
matz 2009-10-30 18:58:25 +0900 (Fri, 30 Oct 2009) New Revision: 25576 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=25576 Log: * string.c (trnext): detect empty range and raise exception. [ruby-dev:39108] Modified files: trunk/ChangeLog trunk/string.c Index: ChangeLog =================================================================== --- ChangeLog (revision 25575) +++ ChangeLog (revision 25576) @@ -1,3 +1,8 @@ +Fri Oct 30 18:54:04 2009 Yukihiro Matsumoto <matz@r...> + + * string.c (trnext): detect empty range and raise exception. + [ruby-dev:39108] + Fri Oct 30 17:01:46 2009 Nobuyoshi Nakada <nobu@r...> * vm_eval.c (enum call_type): get rid of last comma. Index: string.c =================================================================== --- string.c (revision 25575) +++ string.c (revision 25576) @@ -4642,7 +4642,17 @@ if (t->p < t->pend) { unsigned int c = rb_enc_codepoint_len(t->p, t->pend, &n, enc); t->p += n; - if (t->now > c) continue; + if (t->now > c) { + if (t->now < 0x80 && c < 0x80) { + rb_raise(rb_eArgError, + "invalid range \"%c-%c\" in string transliteration", + t->now, c); + } + else { + rb_raise(rb_eArgError, "invalid range in string transliteration"); + } + continue; /* not reached */ + } t->gen = 1; t->max = c; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/