mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 05:38:22 +01:00
Bug-fix: Clamp backward dist to 1.
Check for valid bounds on the 'dist' in backward reference case. Clamp it to 1 in case of zero and negative values. Change-Id: I78e956d4595955efa02b1f9628b475093f6ee001
This commit is contained in:
parent
b5b6ac979f
commit
8a69c7d8af
@ -139,7 +139,8 @@ static WEBP_INLINE int PlaneCodeToDistance(int xsize, int plane_code) {
|
||||
const int dist_code = code_to_plane_lut[plane_code - 1];
|
||||
const int yoffset = dist_code >> 4;
|
||||
const int xoffset = 8 - (dist_code & 0xf);
|
||||
return yoffset * xsize + xoffset;
|
||||
int dist = yoffset * xsize + xoffset;
|
||||
return (dist >= 1) ? dist : 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user