Commit 857fd2ad authored by Pascal Massimino's avatar Pascal Massimino Committed by Michael Niedermayer

avcodec/webp: fix decoding for trailing junk

some bitstream have trailing junk, despite being valid webp data.
In case of apparent error, abort the loop and let *got_frame
decide whether this is an error or not.

fixes trac #8107 (/#7612)

Another possibility would be turning the loop into:
    while (!*got_frame) {...}
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 3740bdee
......@@ -1412,8 +1412,11 @@ static int webp_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
return AVERROR_INVALIDDATA;
chunk_size += chunk_size & 1;
if (bytestream2_get_bytes_left(&gb) < chunk_size)
return AVERROR_INVALIDDATA;
if (bytestream2_get_bytes_left(&gb) < chunk_size) {
/* we seem to be running out of data, but it could also be that the
bitstream has trailing junk leading to bogus chunk_size. */
break;
}
switch (chunk_type) {
case MKTAG('V', 'P', '8', ' '):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment