From f594353f262c49810a6ee7ed8bef3995c4f30efa Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 12 Jan 2021 21:54:31 +0100 Subject: [PATCH] avformat/flvdec: Check for EOF in amf_skip_tag() Fixes: Timeout Fixes: 29070/clusterfuzz-testcase-minimized-ffmpeg_dem_KUX_fuzzer-5650106766458880 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 9725d07a1770fbfafe5f7b3f7d95a2a513308538) Signed-off-by: Michael Niedermayer --- libavformat/flvdec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index db514049e4..0288cd376b 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -857,6 +857,9 @@ static int amf_skip_tag(AVIOContext *pb, AMFDataType type, int depth) if (depth > MAX_DEPTH) return AVERROR_PATCHWELCOME; + if (avio_feof(pb)) + return AVERROR_EOF; + switch (type) { case AMF_DATA_TYPE_NUMBER: avio_skip(pb, 8);