diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 61116a5227..c093c48ae1 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -4437,6 +4437,11 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) else samples_in_chunk = 1; + if (samples_in_chunk < 1) { + av_log(s, AV_LOG_ERROR, "fatal error, input packet contains no samples\n"); + return AVERROR_PATCHWELCOME; + } + /* copy extradata if it exists */ if (trk->vos_len == 0 && enc->extradata_size > 0 && !TAG_IS_AVCI(trk->tag) &&