mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-18 23:09:52 +02:00
Merge changes Id9890a60,I376d81e6,I1c958838 into main
* changes: GetBackwardReferences: fail on alloc error BackwardReferencesHashChainDistanceOnly: fix segfault on OOM VP8LEncodeStream: fix segfault on OOM
This commit is contained in:
@ -1966,14 +1966,19 @@ int VP8LEncodeStream(const WebPConfig* const config,
|
||||
const WebPWorkerInterface* const worker_interface = WebPGetWorkerInterface();
|
||||
int ok_main;
|
||||
|
||||
if (enc_main == NULL || !VP8LBitWriterInit(&bw_side, 0)) {
|
||||
WebPEncodingSetError(picture, VP8_ENC_ERROR_OUT_OF_MEMORY);
|
||||
VP8LEncoderDelete(enc_main);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Avoid "garbage value" error from Clang's static analysis tool.
|
||||
WebPPictureInit(&picture_side);
|
||||
|
||||
// Analyze image (entropy, num_palettes etc)
|
||||
if (enc_main == NULL ||
|
||||
!EncoderAnalyze(enc_main, crunch_configs, &num_crunch_configs_main,
|
||||
if (!EncoderAnalyze(enc_main, crunch_configs, &num_crunch_configs_main,
|
||||
&red_and_blue_always_zero) ||
|
||||
!EncoderInit(enc_main) || !VP8LBitWriterInit(&bw_side, 0)) {
|
||||
!EncoderInit(enc_main)) {
|
||||
WebPEncodingSetError(picture, VP8_ENC_ERROR_OUT_OF_MEMORY);
|
||||
goto Error;
|
||||
}
|
||||
|
Reference in New Issue
Block a user