mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-13 06:24:27 +02:00
Merge changes I46090628,I1a41b2ce into 0.2.0
* changes: check VP8LBitWriterInit return lossless: fix crash on user abort
This commit is contained in:
@ -1050,11 +1050,17 @@ 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;
|
||||
if (!VP8LBitWriterInit(&bw, (width * height) >> 1)) {
|
||||
err = VP8_ENC_ERROR_OUT_OF_MEMORY;
|
||||
goto Error;
|
||||
}
|
||||
|
||||
if (!WebPReportProgress(picture, 1, &percent)) {
|
||||
UserAbort:
|
||||
err = VP8_ENC_ERROR_USER_ABORT;
|
||||
@ -1072,7 +1078,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;
|
||||
|
Reference in New Issue
Block a user