[FFmpeg-cvslog] avformat/movenc: Check input sample count

Michael Niedermayer git at videolan.org
Mon Jul 16 21:33:12 EEST 2018


ffmpeg | branch: release/3.3 | Michael Niedermayer <michael at niedermayer.cc> | Fri Jul  6 22:23:25 2018 +0200| [6a0a16e563f07722acd4b666b2c501e186e9fa4b] | committer: Michael Niedermayer

avformat/movenc: Check input sample count

Fixes: division by 0
Fixes: fpe_movenc.c_199_1.wav
Fixes: fpe_movenc.c_199_2.wav
Fixes: fpe_movenc.c_199_3.wav
Fixes: fpe_movenc.c_199_4.wav
Fixes: fpe_movenc.c_199_5.wav
Fixes: fpe_movenc.c_199_6.wav
Fixes: fpe_movenc.c_199_7.wav

Found-by: #CHEN HONGXU# <HCHEN017 at e.ntu.edu.sg>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 3a2d21bc5f97aa0161db3ae731fc2732be6108b8)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6a0a16e563f07722acd4b666b2c501e186e9fa4b
---

 libavformat/movenc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 11d58274fd..b36322837e 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -4955,6 +4955,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) &&



More information about the ffmpeg-cvslog mailing list