From c3b7afa4e917d748f0c3f8237b04ebdd99bdcacb Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 21 Jul 2019 00:08:55 +0200 Subject: [PATCH] avcodec/utils: Check close before calling it Fixes: NULL pointer dereference Fixes: 15733/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_IDF_fuzzer-5658616977162240 Reviewed-by: Paul B Mahol Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer (cherry picked from commit 8df6884832ec413cf032dfaa45c23b1c7876670c) Signed-off-by: Michael Niedermayer --- libavcodec/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 1a5f4e7e4f..7cd14c8e1e 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1118,7 +1118,7 @@ end: return ret; free_and_end: - if (avctx->codec && + if (avctx->codec && avctx->codec->close && (codec_init_ok || (avctx->codec->caps_internal & FF_CODEC_CAP_INIT_CLEANUP))) avctx->codec->close(avctx);