aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2019-12-09 23:26:04 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-02-09 23:33:18 +0100
commitce920f47930d2a1df6628f026a926425f534e8d2 (patch)
treec0dd5d1aa7d17391570283e469507c1a9acb8862
parentb1aecad9eae900b9c3054392994d150d5ae572c5 (diff)
downloadffmpeg-ce920f47930d2a1df6628f026a926425f534e8d2.tar.gz
avcodec/cbs_mpeg2: Treat slices without data as invalid
They are spec-incompliant. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/cbs_mpeg2.c3
1 files changed, 3 insertions, 0 deletions
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;