summaryrefslogtreecommitdiffstats
path: root/string.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-01-08 18:58:31 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-01-08 18:58:31 +0000
commit7bfed97aaaf2dd495de019b6c42a26f67a7ca8c5 (patch)
tree5951c87fb312bf1cd198209496851fb1db039bec /string.c
parent27bdbebab78c069e7e768d63d0517de697be67e1 (diff)
downloadruby-7bfed97aaaf2dd495de019b6c42a26f67a7ca8c5.tar.gz
ruby-7bfed97aaaf2dd495de019b6c42a26f67a7ca8c5.tar.xz
ruby-7bfed97aaaf2dd495de019b6c42a26f67a7ca8c5.zip
* string.c (rb_str_upto): String#upto from empty string makes
inifinite loop. [ruby-core:09864] git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@11513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/string.c b/string.c
index 455ac4428..49eddf614 100644
--- a/string.c
+++ b/string.c
@@ -1568,7 +1568,7 @@ rb_str_upto(VALUE beg, VALUE end, int excl)
StringValue(current);
if (excl && rb_str_equal(current, end)) break;
StringValue(current);
- if (RSTRING_LEN(current) > RSTRING_LEN(end))
+ if (RSTRING_LEN(current) > RSTRING_LEN(end) || RSTRING(current)->len == 0)
break;
}