aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-07-21 00:08:55 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-01-06 11:30:42 +0100
commitf2c01cc90b36e0efa60cc335bc910746d53e46ce (patch)
treea6a2a6033468f87d3c4161ff24b68381f085108c
parent7cfc42151e235392562fcfb025b8da03287b5bda (diff)
downloadffmpeg-f2c01cc90b36e0efa60cc335bc910746d53e46ce.tar.gz
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 <onemda@gmail.com> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 8df6884832ec413cf032dfaa45c23b1c7876670c) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index d006794b1d..d3ddcbca9d 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1020,7 +1020,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);