X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fwebp.c;h=c6d02068463e3011880f50245784962cb0eef9be;hb=77937a42e7127271bd50d7f8035c3ebd5a1047c5;hp=077bb06f85a7c21e5e94b83aba997213a98ea80c;hpb=aebc5b2284db1f40a5b3e2e9a2bf406f606436c7;p=ffmpeg diff --git a/libavcodec/webp.c b/libavcodec/webp.c index 077bb06f85a..c6d02068463 100644 --- a/libavcodec/webp.c +++ b/libavcodec/webp.c @@ -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', ' '):