diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-06-14 19:51:23 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-07-05 12:43:08 +0200 |
commit | 22669e38e4500b8845c3a2b0bc0854e4c91369c3 (patch) | |
tree | 4b57bee863e555846ec5737fd660a7b4d081e0c0 | |
parent | 30242bcb005157a0cd3c32750b1bee999452027f (diff) | |
download | ffmpeg-22669e38e4500b8845c3a2b0bc0854e4c91369c3.tar.gz |
avformat/4xm: Check that a video stream was created before returning packets for it
Fixes: assertion failure
Fixes: 23434/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5227750851084288.fuzz
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit c517c3f4741b6897ea952d1fba199c93c5217cfe)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/4xm.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/4xm.c b/libavformat/4xm.c index 1f1156c78a..9f40fff346 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -209,6 +209,7 @@ static int fourxm_read_header(AVFormatContext *s) fourxm->track_count = 0; fourxm->tracks = NULL; fourxm->fps = (AVRational){1,1}; + fourxm->video_stream_index = -1; /* skip the first 3 32-bit numbers */ avio_skip(pb, 12); @@ -314,6 +315,8 @@ static int fourxm_read_packet(AVFormatContext *s, case cfr2_TAG: /* allocate 8 more bytes than 'size' to account for fourcc * and size */ + if (fourxm->video_stream_index < 0) + return AVERROR_INVALIDDATA; if (size + 8 < size || av_new_packet(pkt, size + 8)) return AVERROR(EIO); pkt->stream_index = fourxm->video_stream_index; |