aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2018-07-06 22:23:25 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2018-07-08 01:37:54 +0200
commit20ad61ffb7b0fc72d17b5c21035eb85a698ac64b (patch)
tree62a78d40ac9a1abde62bfb067b33ad061b1a2d29 /libavformat
parent9fc60cebe42e6e492b6e1a7bcc479796ee42c3ca (diff)
downloadffmpeg-20ad61ffb7b0fc72d17b5c21035eb85a698ac64b.tar.gz
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@e.ntu.edu.sg> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 3a2d21bc5f97aa0161db3ae731fc2732be6108b8) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/movenc.c5
1 files changed, 5 insertions, 0 deletions
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) &&