aiff: check block_align in aiff_read_packet
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Thu, 20 Oct 2016 18:08:15 +0000 (20:08 +0200)
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Fri, 21 Oct 2016 17:40:59 +0000 (19:40 +0200)
It can be unset in avcodec_parameters_from_context and a value of 0
causes SIGFPE crashes.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
libavformat/aiffdec.c

index de82787..59e969d 100644 (file)
@@ -371,6 +371,11 @@ static int aiff_read_packet(AVFormatContext *s,
     if (max_size <= 0)
         return AVERROR_EOF;
 
+    if (!st->codecpar->block_align) {
+        av_log(s, AV_LOG_ERROR, "block_align not set\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     /* Now for that packet */
     switch (st->codecpar->codec_id) {
     case AV_CODEC_ID_ADPCM_IMA_QT: