diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-05-20 04:18:20 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-05-20 04:32:57 +0200 |
commit | b24fffeb9476b46be89229c8df338a8c8f1a9a62 (patch) | |
tree | 5ded8a65d6db0e1bb0319145f8ebeb2a149e35ff /libavcodec | |
parent | 14992421df88514e64fb56cfa888eade918cfc19 (diff) | |
download | ffmpeg-b24fffeb9476b46be89229c8df338a8c8f1a9a62.tar.gz |
avcodec/utils: Move avctx->codec check before its use
Fixes CID1361954
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/utils.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index e5a832b3b4..11ae4e84c5 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -2281,6 +2281,9 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, *got_frame_ptr = 0; + if (!avctx->codec) + return AVERROR(EINVAL); + if (!avctx->codec->decode) { av_log(avctx, AV_LOG_ERROR, "This decoder requires using the avcodec_send_packet() API.\n"); return AVERROR(ENOSYS); @@ -2290,8 +2293,6 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, av_log(avctx, AV_LOG_ERROR, "invalid packet: NULL data, size != 0\n"); return AVERROR(EINVAL); } - if (!avctx->codec) - return AVERROR(EINVAL); if (avctx->codec->type != AVMEDIA_TYPE_AUDIO) { av_log(avctx, AV_LOG_ERROR, "Invalid media type for audio\n"); return AVERROR(EINVAL); |