Fixed possible overflows to clean KW scan (#15034)

This commit is contained in:
Anastasiya(Asya) Pronina 2023-01-12 08:33:43 +01:00 committed by GitHub
parent 9d574e6041
commit e27c4b0b18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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);
}