Actions
Bug #22301
openWriting to the contents of a frozen IO::Buffer does not raise FrozenError
Bug #22301:
Writing to the contents of a frozen IO::Buffer does not raise FrozenError
Description
Writing to the contents of a frozen IO::Buffer does not raise FrozenError:
buffer = IO::Buffer.new(8)
buffer.freeze
buffer.set_string("x", 0) # no FrozenError
buffer.get_string # => "x\x00\x00\x00\x00\x00\x00\x00"
io_buffer_validate_for_writing() rejects a buffer whose RB_IO_BUFFER_READONLY flag is set, or whose source is frozen, so it already treats frozen as not writable. But it takes a struct rb_io_buffer *, so the receiver never reaches it and the buffer's own frozen state goes unchecked.
Reachable from #set_string, #copy, #clear, #set_value, #set_values, #and!, #or!, #xor!, #not!, #read and #pread. #free, #resize and #transfer already raise as of [Bug #22219].
No data to display
Actions