From 6c45cef7ff27d84330d2034b014716f75d76302e Mon Sep 17 00:00:00 2001 From: Vincent Rabaud Date: Tue, 10 May 2022 10:18:46 +0200 Subject: [PATCH] Make sure the stride has a minimum value in the importer. Bug: webp:569 Change-Id: Ia48d064dbb10e7179ae3da04ca8d769d1c447276 --- src/enc/picture_csp_enc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/enc/picture_csp_enc.c b/src/enc/picture_csp_enc.c index 94afa0d0..0e94d2df 100644 --- a/src/enc/picture_csp_enc.c +++ b/src/enc/picture_csp_enc.c @@ -739,6 +739,8 @@ static int Import(WebPPicture* const picture, const int width = picture->width; const int height = picture->height; + if (abs(rgb_stride) < (import_alpha ? 4 : 3) * width) return 0; + if (!picture->use_argb) { const uint8_t* a_ptr = import_alpha ? rgb + 3 : NULL; return ImportYUVAFromRGBA(r_ptr, g_ptr, b_ptr, a_ptr, step, rgb_stride,