diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 6b6c03e801..5e320bdeae 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -1639,9 +1639,8 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y, } /* extra slice info */ - while (get_bits1(&s->gb) != 0) { - skip_bits(&s->gb, 8); - } + if (skip_1stop_8data_bits(&s->gb) < 0) + return AVERROR_INVALIDDATA; s->mb_x = 0;