mirror of
https://github.com/webmproject/libwebp.git
synced 2025-02-13 07:22:52 +01:00
Mux: fix a scenario with bad ANMF/FRGM size
When a ANMF/FRGM chunk size (read from file) is smaller than ANMF/FRGM header size (which is constant and implicit), the parser should report an error. Change-Id: I91d71889937f5133a97f1e83d5254cb2d7f37028
This commit is contained in:
parent
19eb012c55
commit
be2fd1735a
@ -92,6 +92,9 @@ static int MuxImageParse(const WebPChunk* const chunk, int copy_data,
|
|||||||
const size_t hdr_size = (chunk->tag_ == kChunks[IDX_ANMF].tag) ?
|
const size_t hdr_size = (chunk->tag_ == kChunks[IDX_ANMF].tag) ?
|
||||||
ANMF_CHUNK_SIZE : FRGM_CHUNK_SIZE;
|
ANMF_CHUNK_SIZE : FRGM_CHUNK_SIZE;
|
||||||
const WebPData temp = { bytes, hdr_size };
|
const WebPData temp = { bytes, hdr_size };
|
||||||
|
// Each of ANMF and FRGM chunk contain a header at the beginning. So, its
|
||||||
|
// size should at least be 'hdr_size'.
|
||||||
|
if (size < hdr_size) goto Fail;
|
||||||
ChunkAssignData(&subchunk, &temp, copy_data, chunk->tag_);
|
ChunkAssignData(&subchunk, &temp, copy_data, chunk->tag_);
|
||||||
}
|
}
|
||||||
ChunkSetNth(&subchunk, &wpi->header_, 1);
|
ChunkSetNth(&subchunk, &wpi->header_, 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user