mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (trnext): detect empty range and raise exception.
[ruby-dev:39108] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
db196eef24
commit
104c5f6b55
2 changed files with 16 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Fri Oct 30 18:54:04 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
|
* string.c (trnext): detect empty range and raise exception.
|
||||||
|
[ruby-dev:39108]
|
||||||
|
|
||||||
Fri Oct 30 17:01:46 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Fri Oct 30 17:01:46 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* vm_eval.c (enum call_type): get rid of last comma.
|
* vm_eval.c (enum call_type): get rid of last comma.
|
||||||
|
|
12
string.c
12
string.c
|
@ -4642,7 +4642,17 @@ trnext(struct tr *t, rb_encoding *enc)
|
||||||
if (t->p < t->pend) {
|
if (t->p < t->pend) {
|
||||||
unsigned int c = rb_enc_codepoint_len(t->p, t->pend, &n, enc);
|
unsigned int c = rb_enc_codepoint_len(t->p, t->pend, &n, enc);
|
||||||
t->p += n;
|
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->gen = 1;
|
||||||
t->max = c;
|
t->max = c;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue