aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-09-27 18:54:58 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-09-27 19:09:15 +0200
commit9790a03e67d3b34834ac7cce72feea88ee278d90 (patch)
tree92bb6fe3efb667007be8bc6087e1a2d96c3b6843
parente064d0aaf622a78d15c051602c929b203c45c1e3 (diff)
downloadffmpeg-9790a03e67d3b34834ac7cce72feea88ee278d90.tar.gz
avformat/mxfdec: check sample size more completely
Fixes division by zero Fixes Ticket2992 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/mxfdec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index e8ee74131a..e06673ca5e 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -2195,7 +2195,9 @@ 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)
+ if ( codec->channels <= 0
+ || av_get_bits_per_sample(codec->codec_id) <= 0
+ || codec->channels * (int64_t)av_get_bits_per_sample(codec->codec_id) < 8)
return AVERROR(EINVAL);
track->sample_count += pkt->size / (codec->channels * (int64_t)av_get_bits_per_sample(codec->codec_id) / 8);
return 0;