[FFmpeg-cvslog] avcodec/cbs_mpeg2: Treat slices without data as invalid

Andreas Rheinhardt git at videolan.org
Mon Feb 10 00:34:25 EET 2020


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Mon Dec  9 23:26:04 2019 +0100| [ce920f47930d2a1df6628f026a926425f534e8d2] | committer: Michael Niedermayer

avcodec/cbs_mpeg2: Treat slices without data as invalid

They are spec-incompliant.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ce920f47930d2a1df6628f026a926425f534e8d2
---

 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;
 



More information about the ffmpeg-cvslog mailing list