Fixed possible overflows to clean KW scan (#15431)
Co-authored-by: Anastasiya Pronina <anastasiya.pronina@intel.com>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user