mirror of
https://github.com/webmproject/libwebp.git
synced 2025-08-29 23:32:05 +02:00
misc fixes in libwebpmux
* Assert chunklist * fix potential memory leak and * fix null pointer access There should not be several alpha_ or img_ chunks in SynthesizeBitstream. Use ChunkListDelete in MuxImageRelease to be safe. A null pointer accessed in WebPMuxPushFrame triggered a harmless runtime error. Change-Id: I3027f8752093652bd41f55e667d041c0de77ab6e
This commit is contained in:
@@ -400,6 +400,10 @@ static WebPMuxError SynthesizeBitstream(const WebPMuxImage* const wpi,
|
||||
uint8_t* const data = (uint8_t*)WebPSafeMalloc(1ULL, size);
|
||||
if (data == NULL) return WEBP_MUX_MEMORY_ERROR;
|
||||
|
||||
// There should be at most one alpha_ chunk and exactly one img_ chunk.
|
||||
assert(wpi->alpha_ == NULL || wpi->alpha_->next_ == NULL);
|
||||
assert(wpi->img_ != NULL && wpi->img_->next_ == NULL);
|
||||
|
||||
// Main RIFF header.
|
||||
dst = MuxEmitRiffHeader(data, size);
|
||||
|
||||
|
Reference in New Issue
Block a user