dca: Validate the lfe parameter
authorMartin Storsjö <martin@martin.st>
Thu, 19 Sep 2013 12:12:06 +0000 (15:12 +0300)
committerLuca Barbato <lu_zero@gentoo.org>
Tue, 7 Jan 2014 08:43:57 +0000 (09:43 +0100)
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit a9d50bb578ec04c085a25f1e023f75e0e4499d5e)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
libavcodec/dca.c

index 169c9b4..4d71812 100644 (file)
@@ -578,6 +578,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);