diff options
Diffstat (limited to 'ext/strscan')
-rw-r--r-- | ext/strscan/strscan.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c index dcb70a774..9529bc369 100644 --- a/ext/strscan/strscan.c +++ b/ext/strscan/strscan.c @@ -1,7 +1,7 @@ /* $Id$ - Copyright (c) 1999-2005 Minero Aoki + Copyright (c) 1999-2006 Minero Aoki This program is free software. 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); CLEAR_MATCH_STATUS(p); + if (S_RESTLEN(p) < 0) { + return Qnil; + } if (headonly) { ret = onig_match(RREGEXP(regex)->ptr, (UChar* )CURPTR(p), (UChar* )(CURPTR(p) + S_RESTLEN(p)), |