1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

mpeg12: do not decode extradata more than once.

Fixes CVE-2012-2803.

CC: libav-stable@libav.org
This commit is contained in:
Anton Khirnov 2012-12-13 17:53:31 +01:00
parent c661cb6672
commit 5823686261
2 changed files with 3 additions and 1 deletions

View File

@ -2456,8 +2456,9 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
s->slice_count = 0; s->slice_count = 0;
if (avctx->extradata && !avctx->frame_number) { if (avctx->extradata && !s->extradata_decoded) {
int ret = decode_chunks(avctx, picture, got_output, avctx->extradata, avctx->extradata_size); int ret = decode_chunks(avctx, picture, got_output, avctx->extradata, avctx->extradata_size);
s->extradata_decoded = 1;
if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
return ret; return ret;
} }

View File

@ -42,6 +42,7 @@ typedef struct Mpeg1Context {
AVRational frame_rate_ext; ///< MPEG-2 specific framerate modificator AVRational frame_rate_ext; ///< MPEG-2 specific framerate modificator
int sync; ///< Did we reach a sync point like a GOP/SEQ/KEYFrame? int sync; ///< Did we reach a sync point like a GOP/SEQ/KEYFrame?
int closed_gop; ///< GOP is closed int closed_gop; ///< GOP is closed
int extradata_decoded;
} Mpeg1Context; } Mpeg1Context;
extern uint8_t ff_mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3]; extern uint8_t ff_mpeg12_static_rl_table_store[2][2][2*MAX_RUN + MAX_LEVEL + 3];