From d0a8c7eafca9ff09d573ff5a2f1613f40364213b Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 2 Dec 2021 19:04:41 +0100 Subject: [PATCH] cc_draw: ensure unsigned values avoids possible signed integer overflow runtime errors --- src/gui/components/cc_draw.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_draw.cpp b/src/gui/components/cc_draw.cpp index bdf01d2ce..df8d36e45 100644 --- a/src/gui/components/cc_draw.cpp +++ b/src/gui/components/cc_draw.cpp @@ -908,12 +908,12 @@ int CCDraw::getYPos() const int CCDraw::getHeight() const { - return height; + return std::max(0, height); } int CCDraw::getWidth() const { - return width; + return std::max(0, width); } void CCDraw::setDimensionsAll(const int& xpos, const int& ypos, const int& w, const int& h)