Actions
Bug #3548
closedInfinite loop in rb_str_conv_enc_opts
Bug #3548:
Infinite loop in rb_str_conv_enc_opts
Description
=begin
To reproduce:
require 'stringio'
StringIO.new(''.force_encoding('ISO-2022-JP')) << ''
This will loop forever, blocking the interpreter and requiring a "kill -9" to terminate ruby. The problem is that rb_str_conv_enc_opts does not expect rb_econv_convert() to return econv_destination_buffer_full when the input string length is 0. It attempts to expand the destination buffer by doubling its allocation, which will never be successful when the initial allocation was zero.
The attached patch fixes the problem in rb_str_conv_enc_opts(). I suspect that the ISO-2022-JP encoder should also not be returning econv_destination_buffer_full when processing an empty string.
=end
Files
Actions