diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-07-24 07:19:34 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-07-24 07:19:34 +0000 |
commit | a4fe713cb199934e8b7870850c50fcc24fb5685f (patch) | |
tree | 7d0763676e49c49f8b06b2a74042d7530f71a1e0 /string.c | |
parent | c9accd03e721f1455ccdf3f09f5251d6b93c1b4b (diff) |
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -684,6 +684,10 @@ rb_str_rindex(argc, argv, str) if (rb_scan_args(argc, argv, "11", &sub, &position) == 2) { pos = NUM2INT(position); + if (pos < 0) { + pos += RSTRING(str)->len; + if (pos < 0) return Qnil; + } if (pos > RSTRING(str)->len) pos = RSTRING(str)->len; } else { |