mirror of
https://github.com/webmproject/libwebp.git
synced 2025-12-23 21:46:26 +01:00
Properly validate picture dimensions for overflow
Change-Id: I42735f6c651d0bb768b9c727209a7b5fe991b456
This commit is contained in:
@@ -50,11 +50,8 @@ int WebPPictureInitInternal(WebPPicture* picture, int version) {
|
||||
|
||||
int WebPValidatePicture(const WebPPicture* const picture) {
|
||||
if (picture == NULL) return 0;
|
||||
if (picture->width <= 0 || picture->height <= 0) {
|
||||
return WebPEncodingSetError(picture, VP8_ENC_ERROR_BAD_DIMENSION);
|
||||
}
|
||||
if (picture->width <= 0 || picture->width / 4 > INT_MAX / 4 ||
|
||||
picture->height <= 0 || picture->height / 4 > INT_MAX / 4) {
|
||||
if (picture->width <= 0 || picture->width > INT_MAX / 4 ||
|
||||
picture->height <= 0 || picture->height > INT_MAX / 4) {
|
||||
return WebPEncodingSetError(picture, VP8_ENC_ERROR_BAD_DIMENSION);
|
||||
}
|
||||
if (picture->colorspace != WEBP_YUV420 &&
|
||||
|
||||
Reference in New Issue
Block a user