mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-20 12:28:26 +01:00
lossless: fix crash on user abort
avoid free on uninitialized bit writer buffer Change-Id: I1a41b2cea421bf5a2ea0af33c6e84018cb997caf
This commit is contained in:
parent
a7cc729126
commit
cbfa9eecf4
@ -1051,11 +1051,14 @@ int VP8LEncodeImage(const WebPConfig* const config,
|
||||
|
||||
if (config == NULL || picture->argb == NULL) {
|
||||
err = VP8_ENC_ERROR_NULL_PARAMETER;
|
||||
goto Error;
|
||||
WebPEncodingSetError(picture, err);
|
||||
return 0;
|
||||
}
|
||||
|
||||
width = picture->width;
|
||||
height = picture->height;
|
||||
VP8LBitWriterInit(&bw, (width * height) >> 1);
|
||||
|
||||
if (!WebPReportProgress(picture, 1, &percent)) {
|
||||
UserAbort:
|
||||
err = VP8_ENC_ERROR_USER_ABORT;
|
||||
@ -1073,7 +1076,6 @@ int VP8LEncodeImage(const WebPConfig* const config,
|
||||
}
|
||||
|
||||
// Write image size.
|
||||
VP8LBitWriterInit(&bw, (width * height) >> 1);
|
||||
if (!WriteImageSize(picture, &bw)) {
|
||||
err = VP8_ENC_ERROR_OUT_OF_MEMORY;
|
||||
goto Error;
|
||||
|
Loading…
Reference in New Issue
Block a user