diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-30 09:58:25 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-10-30 09:58:25 +0000 |
commit | 104c5f6b555de908191b70a565579b99402a707f (patch) | |
tree | c7a78a902253ff441ece2d1c9ec02103005d7253 /string.c | |
parent | db196eef2409f618f30b6ced4b652c463e8574cf (diff) | |
download | ruby-104c5f6b555de908191b70a565579b99402a707f.tar.gz |
* 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
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -4642,7 +4642,17 @@ trnext(struct tr *t, rb_encoding *enc) 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; } |