dcadec: Validate the lfe parameter
authorMartin Storsjö <martin@martin.st>
Thu, 19 Sep 2013 12:12:06 +0000 (15:12 +0300)
committerMartin Storsjö <martin@martin.st>
Fri, 20 Sep 2013 11:14:45 +0000 (14:14 +0300)
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
libavcodec/dcadec.c

index 209bca3..2676c59 100644 (file)
@@ -580,6 +580,11 @@ static int dca_parse_frame_header(DCAContext *s)
     s->lfe               = get_bits(&s->gb, 2);
     s->predictor_history = get_bits(&s->gb, 1);
 
+    if (s->lfe > 2) {
+        av_log(s->avctx, AV_LOG_ERROR, "Invalid LFE value: %d\n", s->lfe);
+        return AVERROR_INVALIDDATA;
+    }
+
     /* TODO: check CRC */
     if (s->crc_present)
         s->header_crc    = get_bits(&s->gb, 16);