re.c: applied stack error handling patch. [ruby-dev:22431]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ksaito 2004-04-24 05:34:54 +00:00
parent eb93c74314
commit fa659c1449
2 changed files with 13 additions and 7 deletions

View File

@ -1,3 +1,7 @@
Sat Apr 24 14:32:03 2004 Kazuo Saito <ksaito@uranus.dti.ne.jp>
* re.c: applied stack error handling patch. [ruby-dev:22431]
Sat Apr 24 10:38:31 2004 Dave Thomas <dave@pragprog.com>
* lib/rdoc/markup/simple_markup.rb (SM::SimpleMarkup::group_lines):

16
re.c
View File

@ -920,14 +920,16 @@ rb_reg_search(re, str, pos, reverse)
if (FL_TEST(re, KCODE_FIXED))
kcode_reset_option();
if (result == -2) {
rb_reg_raise(RREGEXP(re)->str, RREGEXP(re)->len,
"Stack overflow in regexp matcher", re);
}
if (result < 0) {
rb_backref_set(Qnil);
return result;
if (result == ONIG_MISMATCH) {
rb_backref_set(Qnil);
return result;
}
else {
char err[ONIG_MAX_ERROR_MESSAGE_LEN];
re_error_code_to_str((UChar* )err, result);
rb_reg_raise(RREGEXP(re)->str, RREGEXP(re)->len, err, 0);
}
}
match = rb_backref_get();