mirror of
https://github.com/webmproject/libwebp.git
synced 2026-04-09 22:30:02 +02:00
Fix potential overflow in FramesAreSimilar
Bug: 496807858 Change-Id: Idc9af6f86a171322dd09e197dafbef59d5e4aa53
This commit is contained in:
@@ -70,8 +70,10 @@ static int FramesAreSimilar(const uint8_t* const rgba1,
|
||||
for (j = 0; j < height; ++j) {
|
||||
for (i = 0; i < width; ++i) {
|
||||
const int stride = width * 4;
|
||||
const size_t offset = j * stride + i;
|
||||
if (!PixelsAreSimilar(rgba1[offset], rgba2[offset], max_allowed_diff)) {
|
||||
size_t offset_row, offset;
|
||||
if (!CheckMultiplicationOverflow(j, stride, &offset_row) ||
|
||||
!CheckAdditionOverflow(offset_row, i, &offset) ||
|
||||
!PixelsAreSimilar(rgba1[offset], rgba2[offset], max_allowed_diff)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user