From 5a7eb689057f051d9c3c78109c3698cfc35e0909 Mon Sep 17 00:00:00 2001 From: a/ Date: Sat, 7 Aug 2021 11:59:38 +0900 Subject: [PATCH] SAGA2: Fix for out-of-bounds intersect --- engines/saga2/rect.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engines/saga2/rect.cpp b/engines/saga2/rect.cpp index 61eee99d3b4..2c0fbffc407 100644 --- a/engines/saga2/rect.cpp +++ b/engines/saga2/rect.cpp @@ -86,10 +86,10 @@ Rect16 intersect(const Rect16 a, const Rect16 b) { y1 = MAX(a.y, b.y); height = MIN(a.y + a.height, b.y + b.height) - y1; -// if ( ( width <= 0 ) || ( height <= 0 ) ) -// return Rect16( 0, 0, 0, 0 ); -// else - return Rect16(x1, y1, width, height); + if ((width <= 0) || (height <= 0)) + return Rect16(0, 0, 0, 0); + else + return Rect16(x1, y1, width, height); } void Rect16::normalize(void) {