From e27c4b0b18c37300fd52c2f3ad0ef051243c0874 Mon Sep 17 00:00:00 2001 From: "Anastasiya(Asya) Pronina" Date: Thu, 12 Jan 2023 08:33:43 +0100 Subject: [PATCH] Fixed possible overflows to clean KW scan (#15034) --- samples/cpp/common/utils/include/samples/common.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/cpp/common/utils/include/samples/common.hpp b/samples/cpp/common/utils/include/samples/common.hpp index 925ee0f1510..b24aac76a89 100644 --- a/samples/cpp/common/utils/include/samples/common.hpp +++ b/samples/cpp/common/utils/include/samples/common.hpp @@ -436,10 +436,10 @@ static UNUSED void addRectangles(unsigned char* data, thickness = 1; } - if (static_cast(x + w) >= width) { + if ((static_cast(x) + w) >= width) { w = static_cast(width - x - 1); } - if (static_cast(y + h) >= height) { + if ((static_cast(y) + h) >= height) { h = static_cast(height - y - 1); }