mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 22:28:22 +01:00
WebPPictureImport*: check output pointer
fixes crash with NULL output pointer in calls to simple encode api (WebPEncodeRGB, etc.) Change-Id: I91e7a1c0e070ea842b0a2a4ac54e981cac8629bf
This commit is contained in:
parent
c07687699b
commit
ec1b2407a4
@ -237,6 +237,8 @@ static size_t Encode(const uint8_t* rgba, int width, int height, int stride,
|
|||||||
WebPMemoryWriter wrt;
|
WebPMemoryWriter wrt;
|
||||||
int ok;
|
int ok;
|
||||||
|
|
||||||
|
if (output == NULL) return 0;
|
||||||
|
|
||||||
if (!WebPConfigPreset(&config, WEBP_PRESET_DEFAULT, quality_factor) ||
|
if (!WebPConfigPreset(&config, WEBP_PRESET_DEFAULT, quality_factor) ||
|
||||||
!WebPPictureInit(&pic)) {
|
!WebPPictureInit(&pic)) {
|
||||||
return 0; // shouldn't happen, except if system installation is broken
|
return 0; // shouldn't happen, except if system installation is broken
|
||||||
|
Loading…
Reference in New Issue
Block a user