parsers: initialize MpegEncContext.slice_context_count to 1
The mpeg4 video, H264 and VC-1 parser hold (directly or indirectly) a MpegEncContext in their private context. Since they do not call the common mpegvideo init function slice_context_count has explicitly set to 1. Prevents a null pointer dereference in the h264 parser and fixes bug 193.
This commit is contained in:
parent
580bb77936
commit
f907615f08
@ -330,6 +330,7 @@ static int init(AVCodecParserContext *s)
|
|||||||
{
|
{
|
||||||
H264Context *h = s->priv_data;
|
H264Context *h = s->priv_data;
|
||||||
h->thread_context[0] = h;
|
h->thread_context[0] = h;
|
||||||
|
h->s.slice_context_count = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,6 +99,7 @@ static av_cold int mpeg4video_parse_init(AVCodecParserContext *s)
|
|||||||
if (!pc->enc)
|
if (!pc->enc)
|
||||||
return -1;
|
return -1;
|
||||||
pc->first_picture = 1;
|
pc->first_picture = 1;
|
||||||
|
pc->enc->slice_context_count = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,9 +184,17 @@ static int vc1_split(AVCodecContext *avctx,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int vc1_parse_init(AVCodecParserContext *s)
|
||||||
|
{
|
||||||
|
VC1ParseContext *vpc = s->priv_data;
|
||||||
|
vpc->v.s.slice_context_count = 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
AVCodecParser ff_vc1_parser = {
|
AVCodecParser ff_vc1_parser = {
|
||||||
.codec_ids = { CODEC_ID_VC1 },
|
.codec_ids = { CODEC_ID_VC1 },
|
||||||
.priv_data_size = sizeof(VC1ParseContext),
|
.priv_data_size = sizeof(VC1ParseContext),
|
||||||
|
.parser_init = vc1_parse_init,
|
||||||
.parser_parse = vc1_parse,
|
.parser_parse = vc1_parse,
|
||||||
.parser_close = ff_parse1_close,
|
.parser_close = ff_parse1_close,
|
||||||
.split = vc1_split,
|
.split = vc1_split,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user