Browse code

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>

Shitiz Garg authored on 2011/12/16 04:06:27
Showing 1 changed files
... ...
@@ -106,6 +106,12 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
106 106
 
107 107
     avio_skip(pb, 4);
108 108
     audio_subsegments = avio_rl16(pb);
109
+
110
+    if (audio_subsegments == 0) {
111
+        av_log_ask_for_sample(s, "MTV files without audio are not supported\n");
112
+        return AVERROR_INVALIDDATA;
113
+    }
114
+
109 115
     mtv->full_segment_size =
110 116
         audio_subsegments * (MTV_AUDIO_PADDING_SIZE + MTV_ASUBCHUNK_DATA_SIZE) +
111 117
         mtv->img_segment_size;