aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-05-31 14:30:43 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-02 19:55:09 +0200
commit97181789302302cac633ecb303cc59f88ae8f594 (patch)
tree6a5d55b486cca96e709f770f259da2f44af8a5d9
parentd46f466bb7041de84834aac5f1cb210ca3abd1b8 (diff)
downloadffmpeg-97181789302302cac633ecb303cc59f88ae8f594.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>
-rw-r--r--libavformat/mlvdec.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavformat/mlvdec.c b/libavformat/mlvdec.c
index 6d774a191d..9d14e93396 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;