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

* ext/strscan/strscan.c (strscan_do_scan): always return nil if p->curr exceeds string size.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
aamine 2006-07-26 09:41:08 +00:00
parent c0a8089044
commit c9500ee8d9
2 changed files with 9 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Wed Jul 26 18:38:13 2006 Minero Aoki <aamine@loveruby.net>
* ext/strscan/strscan.c (strscan_do_scan): always return nil if
p->curr exceeds string size.
Wed Jul 26 18:33:31 2006 Yukihiro Matsumoto <matz@ruby-lang.org> Wed Jul 26 18:33:31 2006 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (Init_eval): rename #invoke_method and * eval.c (Init_eval): rename #invoke_method and

View file

@ -1,7 +1,7 @@
/* /*
$Id$ $Id$
Copyright (c) 1999-2005 Minero Aoki Copyright (c) 1999-2006 Minero Aoki
This program is free software. This program is free software.
You can distribute/modify this program under the terms of You can distribute/modify this program under the terms of
@ -401,6 +401,9 @@ strscan_do_scan(VALUE self, VALUE regex, int succptr, int getstr, int headonly)
GET_SCANNER(self, p); GET_SCANNER(self, p);
CLEAR_MATCH_STATUS(p); CLEAR_MATCH_STATUS(p);
if (S_RESTLEN(p) < 0) {
return Qnil;
}
if (headonly) { if (headonly) {
ret = onig_match(RREGEXP(regex)->ptr, (UChar* )CURPTR(p), ret = onig_match(RREGEXP(regex)->ptr, (UChar* )CURPTR(p),
(UChar* )(CURPTR(p) + S_RESTLEN(p)), (UChar* )(CURPTR(p) + S_RESTLEN(p)),