[FFmpeg-cvslog] mxf_set_audio_pts: fix division by 0

Michael Niedermayer git at videolan.org
Wed Dec 12 11:39:45 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Dec 12 11:35:31 2012 +0100| [75b3911e5a6d8f504723303444f534878e09a954] | committer: Michael Niedermayer

mxf_set_audio_pts: fix division by 0

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/mxfdec.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 0d773c5..e8ecbd9 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2057,6 +2057,8 @@ static int mxf_set_audio_pts(MXFContext *mxf, AVCodecContext *codec, AVPacket *p
 {
     MXFTrack *track = mxf->fc->streams[pkt->stream_index]->priv_data;
     pkt->pts = track->sample_count;
+    if (codec->channels <= 0 || av_get_bits_per_sample(codec->codec_id) <= 0)
+        return AVERROR(EINVAL);
     track->sample_count += pkt->size / (codec->channels * av_get_bits_per_sample(codec->codec_id) / 8);
     return 0;
 }



More information about the ffmpeg-cvslog mailing list