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 + + * 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 * 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;