diff --git a/libavformat/movenc.c b/libavformat/movenc.c index aab3e31010..cfbe554dd4 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -5077,6 +5077,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 && par->extradata_size > 0 && !TAG_IS_AVCI(trk->tag) &&