Commit 4b66e1cc authored by michael's avatar michael

Check codec_id and codec_type in avcodec_open(), based on 43_codec_type_mismatch.patch from chrome

This is said to be able to lead to a stack based buffer overflow.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@19973 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent d30b7612
...@@ -481,7 +481,10 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) ...@@ -481,7 +481,10 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
} }
avctx->codec = 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; avctx->frame_number = 0;
if(avctx->codec->init){ if(avctx->codec->init){
ret = avctx->codec->init(avctx); ret = avctx->codec->init(avctx);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment