From af040cb612f793ee86dacfadccdb1ad7fc4542db Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 8 Jan 2007 18:58:31 +0000 Subject: [PATCH] * string.c (rb_str_upto): String#upto from empty string makes inifinite loop. [ruby-core:09864] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ string.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 26772b6079..12b6527e22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Tue Jan 9 03:54:38 2007 Yukihiro Matsumoto + + * string.c (rb_str_upto): String#upto from empty string makes + inifinite loop. [ruby-core:09864] + Sun Jan 7 18:36:05 2007 Koichi Sasada * thread.c (rb_thread_stop_timer_thread(), rb_thread_reset_timer_thread(), diff --git a/string.c b/string.c index 455ac44289..49eddf6148 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; }