qdm2: check that the FFT size is a power of 2
authorAnton Khirnov <anton@khirnov.net>
Tue, 9 Apr 2013 13:25:20 +0000 (15:25 +0200)
committerAnton Khirnov <anton@khirnov.net>
Wed, 17 Apr 2013 08:56:11 +0000 (10:56 +0200)
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org

libavcodec/qdm2.c

index 91ef524..1e0811c 100644 (file)
@@ -1835,6 +1835,10 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
         av_log(avctx, AV_LOG_ERROR, "Unknown FFT order (%d), contact the developers!\n", s->fft_order);
         return -1;
     }
+    if (s->fft_size != (1 << (s->fft_order - 1))) {
+        av_log(avctx, AV_LOG_ERROR, "FFT size %d not power of 2.\n", s->fft_size);
+        return AVERROR_INVALIDDATA;
+    }
 
     ff_rdft_init(&s->rdft_ctx, s->fft_order, IDFT_C2R);
     ff_mpadsp_init(&s->mpadsp);