]> git.sesse.net Git - ffmpeg/commitdiff
tools/target_dec_fuzzer: Do not increase max_pixels
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 22 Aug 2019 17:29:19 +0000 (19:29 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 23 Aug 2019 12:38:42 +0000 (14:38 +0200)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tools/target_dec_fuzzer.c

index d83039417cfe74109ff56078e325e588b38b9668..5119a7c5da5c67ea0ac92911864f279d4cb7b709 100644 (file)
@@ -180,12 +180,13 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
     }
 
 
-    AVCodecContext* ctx = avcodec_alloc_context3(NULL);
+    AVCodecContext* ctx = avcodec_alloc_context3(c);
     AVCodecContext* parser_avctx = avcodec_alloc_context3(NULL);
     if (!ctx || !parser_avctx)
         error("Failed memory allocation");
 
-    ctx->max_pixels = maxpixels_per_frame; //To reduce false positive OOM and hangs
+    if (ctx->max_pixels == 0 || ctx->max_pixels > maxpixels_per_frame)
+        ctx->max_pixels = maxpixels_per_frame; //To reduce false positive OOM and hangs
 
     if (size > 1024) {
         GetByteContext gbc;