From ce920f47930d2a1df6628f026a926425f534e8d2 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt Date: Mon, 9 Dec 2019 23:26:04 +0100 Subject: [PATCH] avcodec/cbs_mpeg2: Treat slices without data as invalid They are spec-incompliant. Signed-off-by: Andreas Rheinhardt Signed-off-by: Michael Niedermayer --- libavcodec/cbs_mpeg2.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/cbs_mpeg2.c b/libavcodec/cbs_mpeg2.c index 13d871cc89..0e5d08ecbf 100644 --- a/libavcodec/cbs_mpeg2.c +++ b/libavcodec/cbs_mpeg2.c @@ -245,6 +245,9 @@ static int cbs_mpeg2_read_unit(CodedBitstreamContext *ctx, if (err < 0) return err; + if (!get_bits_left(&gbc)) + return AVERROR_INVALIDDATA; + pos = get_bits_count(&gbc); len = unit->data_size;