parser: add av_assert1 to make sure the codec matches
Otherwise this can have some surprising effects (crashes), so let's better not allow it. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
This commit is contained in:
@ -141,6 +141,13 @@ int av_parser_parse2(AVCodecParserContext *s, AVCodecContext *avctx,
|
|||||||
int index, i;
|
int index, i;
|
||||||
uint8_t dummy_buf[AV_INPUT_BUFFER_PADDING_SIZE];
|
uint8_t dummy_buf[AV_INPUT_BUFFER_PADDING_SIZE];
|
||||||
|
|
||||||
|
/* Parsers only work for the specified codec ids. */
|
||||||
|
av_assert1(avctx->codec_id == s->parser->codec_ids[0] ||
|
||||||
|
avctx->codec_id == s->parser->codec_ids[1] ||
|
||||||
|
avctx->codec_id == s->parser->codec_ids[2] ||
|
||||||
|
avctx->codec_id == s->parser->codec_ids[3] ||
|
||||||
|
avctx->codec_id == s->parser->codec_ids[4]);
|
||||||
|
|
||||||
if (!(s->flags & PARSER_FLAG_FETCHED_OFFSET)) {
|
if (!(s->flags & PARSER_FLAG_FETCHED_OFFSET)) {
|
||||||
s->next_frame_offset =
|
s->next_frame_offset =
|
||||||
s->cur_offset = pos;
|
s->cur_offset = pos;
|
||||||
|
Reference in New Issue
Block a user