avcodec/dnxhdenc: check that qmax is within the supported range
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 17 Jan 2014 19:58:43 +0000 (20:58 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 17 Jan 2014 19:58:43 +0000 (20:58 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/dnxhdenc.c

index b16c7ed..ab2b7c6 100644 (file)
@@ -341,6 +341,11 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
         return -1;
     }
 
+    if (avctx->qmax <= 1) {
+        av_log(avctx, AV_LOG_ERROR, "qmax must be at least 2\n");
+        return AVERROR(EINVAL);
+    }
+
     ctx->thread[0] = ctx;
     for (i = 1; i < avctx->thread_count; i++) {
         ctx->thread[i] =  av_malloc(sizeof(DNXHDEncContext));