Fixed possible overflows to clean KW scan (#15431)

Co-authored-by: Anastasiya Pronina <anastasiya.pronina@intel.com>
This commit is contained in:
Iosif Dirlea 2023-02-01 12:50:32 +02:00 committed by GitHub
parent e52e6e6547
commit b3f2187a17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -436,10 +436,10 @@ static UNUSED void addRectangles(unsigned char* data,
thickness = 1;
}
if (static_cast<std::size_t>(x + w) >= width) {
if ((static_cast<std::size_t>(x) + w) >= width) {
w = static_cast<int>(width - x - 1);
}
if (static_cast<std::size_t>(y + h) >= height) {
if ((static_cast<std::size_t>(y) + h) >= height) {
h = static_cast<int>(height - y - 1);
}