Bug #20933
closedUnexpected IO::Buffer::MaskError in IO::Buffer#xor!
Description
The following script raises Mask overlaps source buffer! (IO::Buffer::MaskError)
most of the time when running it on my Ubuntu 24.04 machine.
"Most of the time" means this sometimes (20% - 30%) works without issue.
a = IO::Buffer.new(1024 * 1024)
b = IO::Buffer.new(1024 * 1024)
a = IO::Buffer.new(1024 * 1024) # Removing this line makes this work much more reliably
a.xor!(b)
I'm guessing this is somehow related to these being MAPPED
buffers - reducing the sizes to 1024 bytes also fixes the problem.
Updated by peterzhu2118 (Peter Zhu) 21 days ago
Thank you for this bug report. I have a fix here: https://github.com/ruby/ruby/pull/12284
Updated by agitter (Alexander Gitter) 21 days ago
I just gave your branch a quick test and can confirm it fixes this issue. Thank you!
Updated by peterzhu2118 (Peter Zhu) 19 days ago
- Status changed from Open to Closed
Applied in changeset git|7341a4fc07ec8f12ff25538d39383ecf68a5f852.
[Bug #20933] Fix IO::Buffer overlap calculation
The allocated buffers may be consecutive memory addresses. This will mean
that b->base == a->base + a->size
even though a
and b
are separate
buffers.