Actions
Bug #21212
openIO::Buffer can be freed while its slice is locked
Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 3.5.0dev (2025-04-01T16:11:01Z master 30e5e7c005) +PRISM [x86_64-linux]
Description
buffer = IO::Buffer.new(100)
slice = buffer.slice
buffer.locked do
buffer.free rescue p $! #=> IO::Buffer::LockedError (expected)
end
slice.locked do
p slice.locked? #=> true (expected)
p buffer.locked? #=> false (what should this be?)
slice.free rescue p $! #=> IO::Buffer::LockedError (expected)
buffer.free # Should we allow this?
slice.set_value(:U8, 0, 42) # raises IO::Buffer::InvalidatedError (surprising!)
end
No data to display
Actions
Like0