From ec1b2407a49f36ba31786e799c319b782fa96f01 Mon Sep 17 00:00:00 2001 From: James Zern Date: Fri, 25 Mar 2016 18:21:13 -0700 Subject: [PATCH] WebPPictureImport*: check output pointer fixes crash with NULL output pointer in calls to simple encode api (WebPEncodeRGB, etc.) Change-Id: I91e7a1c0e070ea842b0a2a4ac54e981cac8629bf --- src/enc/picture.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/enc/picture.c b/src/enc/picture.c index 26679a72..d9befbc4 100644 --- a/src/enc/picture.c +++ b/src/enc/picture.c @@ -237,6 +237,8 @@ static size_t Encode(const uint8_t* rgba, int width, int height, int stride, WebPMemoryWriter wrt; int ok; + if (output == NULL) return 0; + if (!WebPConfigPreset(&config, WEBP_PRESET_DEFAULT, quality_factor) || !WebPPictureInit(&pic)) { return 0; // shouldn't happen, except if system installation is broken