1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* re.c (rb_reg_initialize): raise RegexpError when encoding

is dummy encoding. [ruby-dev:37091]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2008-12-10 02:29:05 +00:00
parent e8da366e04
commit d433a70b5d
2 changed files with 10 additions and 0 deletions

View file

@ -1,3 +1,8 @@
Wed Dec 10 11:25:53 2008 NARUSE, Yui <naruse@ruby-lang.org>
* re.c (rb_reg_initialize): raise RegexpError when encoding
is dummy encoding. [ruby-dev:37091]
Wed Dec 10 01:28:16 2008 NAKAMURA Usaku <usa@ruby-lang.org> Wed Dec 10 01:28:16 2008 NAKAMURA Usaku <usa@ruby-lang.org>
* common.mk (win32.obj): depend on headers. * common.mk (win32.obj): depend on headers.

5
re.c
View file

@ -2312,6 +2312,11 @@ rb_reg_initialize(VALUE obj, const char *s, int len, rb_encoding *enc,
rb_raise(rb_eTypeError, "already initialized regexp"); rb_raise(rb_eTypeError, "already initialized regexp");
re->ptr = 0; re->ptr = 0;
if (rb_enc_dummy_p(enc)) {
strcpy(err, "can't make regexp with dummy encoding");
return -1;
}
unescaped = rb_reg_preprocess(s, s+len, enc, &fixed_enc, err); unescaped = rb_reg_preprocess(s, s+len, enc, &fixed_enc, err);
if (unescaped == Qnil) if (unescaped == Qnil)
return -1; return -1;