Actions
Bug #17661
closedIO#each will segfault when if file is closed inside an `each_byte` block
Bug #17661: IO#each will segfault when if file is closed inside an `each_byte` block
Description
As reported here: https://twitter.com/asterite/status/1363487990203506689 when iterating through a file's contents with #each_byte, if the filehandle is closed inside of the block yielded to by #each byte, this condition is not detected, and a segmentation fault is thrown.
Repro:
file = http://File.open(__FILE__) file.each_byte do |byte| p byte file.close end Proposed fix is here: https://github.com/ruby/ruby/pull/4217
Actions