summaryrefslogtreecommitdiff
path: root/libavformat/mtv.c
diff options
context:
space:
mode:
authorShitiz Garg <mail@dragooon.net>2011-12-16 00:36:27 +0530
committerJustin Ruggles <justin.ruggles@gmail.com>2012-01-04 17:47:19 -0500
commitfeb15cee5e19a1e31d075ec08d598d64c2dc38ef (patch)
tree64689fb3d91dd0011a15c4671d78593369cac41e /libavformat/mtv.c
parentf13a9ca90602408d96fcbaf249a299ac1243609c (diff)
mtv: Make sure audio_subsegments is not 0
audio_subsegments would be 0 and cause floating point exceptions Fixes bugzilla #144 Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
Diffstat (limited to 'libavformat/mtv.c')
-rw-r--r--libavformat/mtv.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/mtv.c b/libavformat/mtv.c
index c3fb15c344..4c3b082881 100644
--- a/libavformat/mtv.c
+++ b/libavformat/mtv.c
@@ -106,6 +106,12 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_skip(pb, 4);
audio_subsegments = avio_rl16(pb);
+
+ if (audio_subsegments == 0) {
+ av_log_ask_for_sample(s, "MTV files without audio are not supported\n");
+ return AVERROR_INVALIDDATA;
+ }
+
mtv->full_segment_size =
audio_subsegments * (MTV_AUDIO_PADDING_SIZE + MTV_ASUBCHUNK_DATA_SIZE) +
mtv->img_segment_size;