[FFmpeg-cvslog] avcodec/mjpegbdec: use init_get_bits8()

Paul B Mahol git at videolan.org
Wed Sep 21 16:00:49 EEST 2022


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Wed Sep 21 14:59:53 2022 +0200| [b9d71cdb9e920490aec72ec5c17fdf091725c4b4] | committer: Paul B Mahol

avcodec/mjpegbdec: use init_get_bits8()

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

 libavcodec/mjpegbdec.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavcodec/mjpegbdec.c b/libavcodec/mjpegbdec.c
index e74addb24b..dfc55d6cf8 100644
--- a/libavcodec/mjpegbdec.c
+++ b/libavcodec/mjpegbdec.c
@@ -64,10 +64,8 @@ read_header:
     s->restart_count = 0;
     s->mjpb_skiptosod = 0;
 
-    if (buf_end - buf_ptr >= 1 << 28)
-        return AVERROR_INVALIDDATA;
-
-    init_get_bits(&hgb, buf_ptr, /*buf_size*/(buf_end - buf_ptr)*8);
+    if ((ret = init_get_bits8(&hgb, buf_ptr, /*buf_size*/(buf_end - buf_ptr))) < 0)
+        return ret;
 
     skip_bits(&hgb, 32); /* reserved zeros */
 



More information about the ffmpeg-cvslog mailing list