diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2020-05-31 14:30:43 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-07-03 12:10:24 +0200 |
commit | e01d07c781df95bc4096832415debfb1c4c7ad88 (patch) | |
tree | 9a91d0129e4440ec5919fc7d333d184872f7f1d4 /libavformat | |
parent | be9e89efcde74635e120505c7f1bd0071e292011 (diff) | |
download | ffmpeg-e01d07c781df95bc4096832415debfb1c4c7ad88.tar.gz |
avformat/mlvdec: fail reading a packet with 0 streams
Fixes: NULL pointer dereference
Fixes: 22604/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5667739074297856.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 5bd5c3108786bf69f108c55c375f1956f67ca7a4)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/mlvdec.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/mlvdec.c b/libavformat/mlvdec.c index ded8196af2..d6614908b9 100644 --- a/libavformat/mlvdec.c +++ b/libavformat/mlvdec.c @@ -393,10 +393,14 @@ static int read_packet(AVFormatContext *avctx, AVPacket *pkt) { MlvContext *mlv = avctx->priv_data; AVIOContext *pb; - AVStream *st = avctx->streams[mlv->stream_index]; + AVStream *st; int index, ret; unsigned int size, space; + if (!avctx->nb_streams) + return AVERROR_EOF; + + st = avctx->streams[mlv->stream_index]; if (mlv->pts >= st->duration) return AVERROR_EOF; |