From 6c57c0a39b5318e5a0b0fb7597a9ac32a7caefc6 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 13 Nov 2021 12:26:36 +0100 Subject: [PATCH] cc_draw: avoid possible runtime error with signed integer overflow Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/f2e4e8b9d7ab7173d71055cc43c7ae2dd2e4527c Author: Thilo Graf Date: 2021-11-13 (Sat, 13 Nov 2021) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/components/cc_draw.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/components/cc_draw.cpp b/src/gui/components/cc_draw.cpp index 76fc8c420..e7c11c7ac 100644 --- a/src/gui/components/cc_draw.cpp +++ b/src/gui/components/cc_draw.cpp @@ -121,11 +121,13 @@ bool CCDraw::applyDimChanges() { bool ret = false; if (height != height_old){ + height = std::max(0, height); dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], dim changes height %d != height_old %d...\033[0m\n", __func__, __LINE__, height, height_old); height_old = height; ret = true; } if (width != width_old){ + width = std::max(0, width); dprintf(DEBUG_INFO, "\033[33m[CCDraw]\t[%s - %d], dim changes width %d != width_old %d...\033[0m\n", __func__, __LINE__, width, width_old); width_old = width; ret = true;