Index: third_party/libwebp/dec/buffer.c |
diff --git a/third_party/libwebp/dec/buffer.c b/third_party/libwebp/dec/buffer.c |
index 2129312fd6015ff13749f7efce1b5fe3770d79ce..9ed2b3fe1a5f7c09c95c18f64b2b821bb85232b8 100644 |
--- a/third_party/libwebp/dec/buffer.c |
+++ b/third_party/libwebp/dec/buffer.c |
@@ -189,11 +189,14 @@ VP8StatusCode WebPAllocateDecBuffer(int w, int h, |
h = ch; |
} |
if (options->use_scaling) { |
- if (options->scaled_width <= 0 || options->scaled_height <= 0) { |
+ int scaled_width = options->scaled_width; |
+ int scaled_height = options->scaled_height; |
+ if (!WebPRescalerGetScaledDimensions( |
+ w, h, &scaled_width, &scaled_height)) { |
return VP8_STATUS_INVALID_PARAM; |
} |
- w = options->scaled_width; |
- h = options->scaled_height; |
+ w = scaled_width; |
+ h = scaled_height; |
} |
} |
out->width = w; |
@@ -203,12 +206,10 @@ VP8StatusCode WebPAllocateDecBuffer(int w, int h, |
status = AllocateBuffer(out); |
if (status != VP8_STATUS_OK) return status; |
-#if WEBP_DECODER_ABI_VERSION > 0x0203 |
// Use the stride trick if vertical flip is needed. |
if (options != NULL && options->flip) { |
status = WebPFlipBuffer(out); |
} |
-#endif |
return status; |
} |