Fixed possible overflows to clean KW scan (#15034)
This commit is contained in:
parent
9d574e6041
commit
e27c4b0b18
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user