summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/utils.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 1ec039e5e9..c31608df99 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -481,7 +481,10 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
}
avctx->codec = codec;
- avctx->codec_id = codec->id;
+ if(avctx->codec_id != codec->id || avctx->codec_type != codec->type){
+ av_log(avctx, AV_LOG_ERROR, "codec type or id mismatches\n");
+ goto end;
+ }
avctx->frame_number = 0;
if(avctx->codec->init){
ret = avctx->codec->init(avctx);