summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-10 04:06:12 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-07-10 04:06:12 +0000
commite70ad1897b9e4675e04033d7eb72dc16f2038e18 (patch)
treed2e8c46146591530b5662ff1af6574bf31b26bfa
parentf813b7dc1a34800bb675ffd83d6d05013b10c5d8 (diff)
merges r28577 from trunk into ruby_1_9_2.
-- * string.c (rb_str_conv_enc_opts): fix infinite loop because of ISO-2022-JP conversion with empty string. patched by Brian Buchanan [ruby-core:31107] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@28605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--string.c2
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 56dd36565c..f37abc8999 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Jul 8 15:47:34 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * string.c (rb_str_conv_enc_opts): fix infinite loop because
+ of ISO-2022-JP conversion with empty string.
+ patched by Brian Buchanan [ruby-core:31107]
+
Wed Jul 7 10:26:20 2010 NARUSE, Yui <naruse@ruby-lang.org>
* missing/close.c: ignore ECONNRESET.
diff --git a/string.c b/string.c
index 8cfbb56bdf..1b06370bb7 100644
--- a/string.c
+++ b/string.c
@@ -513,7 +513,7 @@ rb_str_conv_enc_opts(VALUE str, rb_encoding *from, rb_encoding *to, int ecflags,
switch (ret) {
case econv_destination_buffer_full:
/* destination buffer short */
- len *= 2;
+ len = len < 2 ? 2 : len * 2;
rb_str_resize(newstr, len);
goto retry;