mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-02-04 06:08:26 +02:00
indeo5dec: Make sure we have had a valid gop header.
This prevents decoding happening on a half initialized context. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
9879b506b0
commit
229e4c1332
@ -76,6 +76,8 @@ typedef struct {
|
|||||||
int is_scalable;
|
int is_scalable;
|
||||||
uint32_t lock_word;
|
uint32_t lock_word;
|
||||||
IVIPicConfig pic_conf;
|
IVIPicConfig pic_conf;
|
||||||
|
|
||||||
|
int gop_invalid;
|
||||||
} IVI5DecContext;
|
} IVI5DecContext;
|
||||||
|
|
||||||
|
|
||||||
@ -336,8 +338,10 @@ static int decode_pic_hdr(IVI5DecContext *ctx, AVCodecContext *avctx)
|
|||||||
ctx->frame_num = get_bits(&ctx->gb, 8);
|
ctx->frame_num = get_bits(&ctx->gb, 8);
|
||||||
|
|
||||||
if (ctx->frame_type == FRAMETYPE_INTRA) {
|
if (ctx->frame_type == FRAMETYPE_INTRA) {
|
||||||
|
ctx->gop_invalid = 1;
|
||||||
if (decode_gop_header(ctx, avctx))
|
if (decode_gop_header(ctx, avctx))
|
||||||
return -1;
|
return -1;
|
||||||
|
ctx->gop_invalid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx->frame_type != FRAMETYPE_NULL) {
|
if (ctx->frame_type != FRAMETYPE_NULL) {
|
||||||
@ -751,7 +755,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
|
|||||||
ctx->frame_size = buf_size;
|
ctx->frame_size = buf_size;
|
||||||
|
|
||||||
result = decode_pic_hdr(ctx, avctx);
|
result = decode_pic_hdr(ctx, avctx);
|
||||||
if (result) {
|
if (result || ctx->gop_invalid) {
|
||||||
av_log(avctx, AV_LOG_ERROR,
|
av_log(avctx, AV_LOG_ERROR,
|
||||||
"Error while decoding picture header: %d\n", result);
|
"Error while decoding picture header: %d\n", result);
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user