From b3f2187a174d3dea06d79655f45043126a029414 Mon Sep 17 00:00:00 2001 From: Iosif Dirlea Date: Wed, 1 Feb 2023 12:50:32 +0200 Subject: [PATCH] Fixed possible overflows to clean KW scan (#15431) Co-authored-by: Anastasiya Pronina --- 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 6a4a701190d..531fd284ac7 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); }