tools/target_enc_fuzzer: Only read pix_fmts if its set

Fixes: null pointer dereference
Fixes: rawvideo encoder
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent c2918eb8
......@@ -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:{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment