Fixes: null pointer dereference
Fixes: rawvideo encoder

Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>
---
 tools/target_enc_fuzzer.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tools/target_enc_fuzzer.c b/tools/target_enc_fuzzer.c
index 1749f6905bd..0345595ada7 100644
--- a/tools/target_enc_fuzzer.c
+++ b/tools/target_enc_fuzzer.c
@@ -130,10 +130,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 
size) {
 
         flags64 = bytestream2_get_le64(&gbc);
 
-        int npixfmts = 0;
-        while (c->p.pix_fmts[npixfmts++] != AV_PIX_FMT_NONE)
-            ;
-        ctx->pix_fmt = c->p.pix_fmts[bytestream2_get_byte(&gbc) % npixfmts];
+        if (c->p.pix_fmts) {
+            int npixfmts = 0;
+            while (c->p.pix_fmts[npixfmts++] != AV_PIX_FMT_NONE)
+                ;
+            ctx->pix_fmt = c->p.pix_fmts[bytestream2_get_byte(&gbc) % 
npixfmts];
+        }
 
         switch (c->p.id) {
         case AV_CODEC_ID_FFV1:{
-- 
2.43.2

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to