diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2019-12-09 23:26:04 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-02-09 23:33:18 +0100 |
commit | ce920f47930d2a1df6628f026a926425f534e8d2 (patch) | |
tree | c0dd5d1aa7d17391570283e469507c1a9acb8862 | |
parent | b1aecad9eae900b9c3054392994d150d5ae572c5 (diff) | |
download | ffmpeg-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.c | 3 |
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; |