diff --git a/libavformat/wtvdec.c b/libavformat/wtvdec.c index cd0a4545af..23cfcda570 100644 --- a/libavformat/wtvdec.c +++ b/libavformat/wtvdec.c @@ -862,7 +862,8 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p } buf_size = FFMIN(len - consumed, sizeof(buf)); - avio_read(pb, buf, buf_size); + if (avio_read(pb, buf, buf_size) != buf_size) + return AVERROR_INVALIDDATA; consumed += buf_size; ff_parse_mpeg2_descriptor(s, st, 0, &pbuf, buf + buf_size, NULL, 0, 0, NULL); }