mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
muxread,MuxImageParse: add missing error checks
This prevents leaks should an allocation fail. Spotted by Philippe Antoine (p dot antoine at catenacyber dot fr) and https://github.com/catenacyber/nallocfuzz. Change-Id: I07a8a475a282b18bf2f9015cc5b1120772babd48
This commit is contained in:
parent
ebb6f949f4
commit
2e5a9ec3b6
@ -116,9 +116,12 @@ static int MuxImageParse(const WebPChunk* const chunk, int copy_data,
|
|||||||
// Each of ANMF chunk contain a header at the beginning. So, its size should
|
// Each of ANMF chunk contain a header at the beginning. So, its size should
|
||||||
// be at least 'hdr_size'.
|
// be at least 'hdr_size'.
|
||||||
if (size < hdr_size) goto Fail;
|
if (size < hdr_size) goto Fail;
|
||||||
ChunkAssignData(&subchunk, &temp, copy_data, chunk->tag_);
|
if (ChunkAssignData(&subchunk, &temp, copy_data,
|
||||||
|
chunk->tag_) != WEBP_MUX_OK) {
|
||||||
|
goto Fail;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ChunkSetHead(&subchunk, &wpi->header_);
|
if (ChunkSetHead(&subchunk, &wpi->header_) != WEBP_MUX_OK) goto Fail;
|
||||||
wpi->is_partial_ = 1; // Waiting for ALPH and/or VP8/VP8L chunks.
|
wpi->is_partial_ = 1; // Waiting for ALPH and/or VP8/VP8L chunks.
|
||||||
|
|
||||||
// Rest of the chunks.
|
// Rest of the chunks.
|
||||||
|
Loading…
Reference in New Issue
Block a user