From c8ae7a57d12bde0c4b9f31c6497e688eca896779 Mon Sep 17 00:00:00 2001 From: Eric-Paul Ickhorn Date: Tue, 12 Dec 2023 23:33:26 +0100 Subject: [PATCH] Fixed a logic bug in the memory overlap check function --- core/src-c/memory.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src-c/memory.c b/core/src-c/memory.c index 051d058..b689529 100644 --- a/core/src-c/memory.c +++ b/core/src-c/memory.c @@ -14,10 +14,12 @@ bool_t rr_mem_overlap(void *block1, usz_t length1, void *block2, usz_t length2) } usz_t start1 = (usz_t) block1; usz_t start2 = (usz_t) block2; + usz_t end1 = start1 + length1; usz_t end2 = start2 + length2; if(end2 > start1) { + if(start2 > end1) return FALSE; return TRUE; } return FALSE;