From: "himura467 (Akito Shitara) via ruby-core" Date: 2026-07-30T15:24:02+00:00 Subject: [ruby-core:126200] [Ruby Bug#22219] IO::Buffer#free, #resize and #transfer should raise FrozenError if the receiver is frozen Issue #22219 has been reported by himura467 (Akito Shitara). ---------------------------------------- Bug #22219: IO::Buffer#free, #resize and #transfer should raise FrozenError if the receiver is frozen https://bugs.ruby-lang.org/issues/22219 * Author: himura467 (Akito Shitara) * Status: Open * Backport: 3.3: UNKNOWN, 3.4: UNKNOWN, 4.0: UNKNOWN ---------------------------------------- Currently `IO::Buffer#free`, `#resize` and `#transfer` can be called even if the receiver is frozen. All three release, reallocate or hand away the memory the buffer references, so they change the state of the buffer. Therefore it seems a bug to me, and these methods should raise `FrozenError` if the receiver is frozen. ```ruby # Current IO::Buffer.new(4).freeze.free # succeeds, the buffer becomes null IO::Buffer.new(4).freeze.resize(8) # succeeds, the memory is reallocated IO::Buffer.new(4).freeze.transfer # succeeds, the receiver becomes null # Expected IO::Buffer.new(4).freeze.free # raise FrozenError IO::Buffer.new(4).freeze.resize(8) # raise FrozenError IO::Buffer.new(4).freeze.transfer # raise FrozenError ``` Methods to fix: * `IO::Buffer#free` * `IO::Buffer#resize` * `IO::Buffer#transfer` -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/