diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2024-05-05 03:14:26 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2024-05-09 16:17:39 +0200 |
commit | 24bd01ea65eb5a9902a0ce8e38f82dcec7117f87 (patch) | |
tree | 79fa45fbd5fb2b4d9d99ecd1f21ceeb32d1eca52 | |
parent | c2918eb88ecb93764809bd158cddbb8d73f89db8 (diff) | |
download | ffmpeg-24bd01ea65eb5a9902a0ce8e38f82dcec7117f87.tar.gz |
tools/target_enc_fuzzer: Only read pix_fmts if its set
Fixes: null pointer dereference
Fixes: rawvideo encoder
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | tools/target_enc_fuzzer.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/target_enc_fuzzer.c b/tools/target_enc_fuzzer.c index 1749f6905b..0345595ada 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:{ |