[FFmpeg-cvslog] avcodec/mpeg12dec: use init_get_bits8 and check the return value

Thierry Foucu git at videolan.org
Wed Jan 4 21:20:17 EET 2023


ffmpeg | branch: release/5.1 | Thierry Foucu <tfoucu at gmail.com> | Wed Jan  4 10:54:24 2023 -0800| [070b38167c10f7742c449c25e65ffef90c8f8f0b] | committer: James Almer

avcodec/mpeg12dec: use init_get_bits8 and check the return value

Signed-off-by: James Almer <jamrial at gmail.com>
(cherry picked from commit efbe84eb1b74a80cd12174feaaa37da2e8fb1e66)

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

 libavcodec/mpeg12dec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index e9bde48f7a..ed1d09fc62 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -2553,7 +2553,9 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture,
             }
             break;
         case EXT_START_CODE:
-            init_get_bits(&s2->gb, buf_ptr, input_size * 8);
+            ret = init_get_bits8(&s2->gb, buf_ptr, input_size);
+            if (ret < 0)
+                return ret;
 
             switch (get_bits(&s2->gb, 4)) {
             case 0x1:



More information about the ffmpeg-cvslog mailing list