From 06e8711a363471e285936224b13c77b338f38cbf 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 Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/9874a589c73643e3dd8ae9781fd83273474e7e6b Author: Thilo Graf Date: 2021-12-02 (Thu, 02 Dec 2021) --- 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)