From 7341a4fc07ec8f12ff25538d39383ecf68a5f852 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 6 Dec 2024 15:08:24 -0500 Subject: [PATCH] [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. --- io_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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