[FFmpeg-devel] [PATCH] avcodec/utils: Fix null pointer dereference with user specific codec_id
Michael Niedermayer
michaelni at gmx.at
Mon Jun 1 21:00:36 CEST 2015
Fixes CID1302837
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
---
libavcodec/utils.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 8695cb9..7e3f92a 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1616,6 +1616,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
avctx->pts_correction_last_dts = INT64_MIN;
if ( !CONFIG_GRAY && avctx->flags & CODEC_FLAG_GRAY
+ && avctx->codec_descriptor
&& avctx->codec_descriptor->type == AVMEDIA_TYPE_VIDEO)
av_log(avctx, AV_LOG_WARNING,
"gray decoding requested but not enabled at configuration time\n");
@@ -1664,7 +1665,8 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
"supported with subtitles codecs\n");
ret = AVERROR(EINVAL);
goto free_and_end;
- } else if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB) {
+ } else if (avctx->codec_descriptor &&
+ avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB) {
av_log(avctx, AV_LOG_WARNING, "Codec '%s' is bitmap-based, "
"subtitles character encoding will be ignored\n",
avctx->codec_descriptor->name);
--
1.7.9.5
More information about the ffmpeg-devel
mailing list