Browse Source

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.

Originally committed as revision 19973 to svn://svn.ffmpeg.org/ffmpeg/trunk
tags/v0.6
Michael Niedermayer 16 years ago
parent
commit
4c0dda2b3f
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      libavcodec/utils.c

+ 4
- 1
libavcodec/utils.c View File

@@ -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);


Loading…
Cancel
Save