summaryrefslogtreecommitdiff
path: root/io_buffer.c
diff options
authorPeter Zhu <[email protected]>2024-12-06 15:08:24 -0500
committerPeter Zhu <[email protected]>2024-12-09 11:52:02 -0500
commit7341a4fc07ec8f12ff25538d39383ecf68a5f852 (patch)
tree2ec68c86a72a0f8fd5ffd5c3500777b88113a163 /io_buffer.c
parent8010d79bb429ed8dac5244e481ba5ddc108797a2 (diff)
[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.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12284
Diffstat (limited to 'io_buffer.c')
-rw-r--r--io_buffer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/io_buffer.c b/io_buffer.c
index 19c755474a..a4b7d30018 100644
--- a/io_buffer.c
+++ b/io_buffer.c
@@ -3395,7 +3395,7 @@ io_buffer_overlaps(const struct rb_io_buffer *a, const struct rb_io_buffer *b)
return io_buffer_overlaps(b, a);
}
- return (b->base >= a->base) && (b->base <= (void*)((unsigned char *)a->base + a->size));
+ return (b->base >= a->base) && (b->base < (void*)((unsigned char *)a->base + a->size));
}
static inline void