diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-03-19 09:03:11 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-03-19 09:03:11 +0000 |
commit | 6d2e56ce7c3e7e53745105ed2d1011e522bcbbbe (patch) | |
tree | 23aee851c864b85cc51a60cd34e8dc4d2f700d13 /re.c | |
parent | 7632b48a7dc19870c04f6769f473dfb13abe2410 (diff) | |
download | ruby-6d2e56ce7c3e7e53745105ed2d1011e522bcbbbe.tar.gz |
* re.c (rb_reg_search): should clear last_match if pos is out of
string range.
* string.c (rb_str_index_m): ditto.
* string.c (rb_str_rindex): ditto.
* class.c (rb_define_class): should handle autoload.
* class.c (rb_define_module): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r-- | re.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -613,7 +613,10 @@ rb_reg_search(re, str, pos, reverse) static struct re_registers regs; int range; - if (pos > RSTRING(str)->len) return -1; + if (pos > RSTRING(str)->len || pos < 0) { + rb_backref_set(Qnil); + return -1; + } rb_reg_check(re); if (may_need_recompile) rb_reg_prepare_re(re); |