[FFmpeg-cvslog] avcodec/mpeg12dec: Use 64bit in bit computation

Michael Niedermayer git at videolan.org
Mon May 20 00:46:09 EEST 2024


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat May 11 21:04:00 2024 +0200| [4c725df059dd9a5f2071e204924105b3ceb74cbc] | committer: Michael Niedermayer

avcodec/mpeg12dec: Use 64bit in bit computation

I dont think this can actually overflow but 64bit seems reasonable to use

Fixes: CID1521983 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/mpeg12dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index a9fe3503db..9fd765f030 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -2734,7 +2734,7 @@ static int ipu_decode_frame(AVCodecContext *avctx, AVFrame *frame,
     int ret;
 
     // Check for minimal intra MB size (considering mb header, luma & chroma dc VLC, ac EOB VLC)
-    if (avpkt->size*8LL < (avctx->width+15)/16 * ((avctx->height+15)/16) * (2 + 3*4 + 2*2 + 2*6))
+    if (avpkt->size*8LL < (avctx->width+15)/16 * ((avctx->height+15)/16) * (2LL + 3*4 + 2*2 + 2*6))
         return AVERROR_INVALIDDATA;
 
     ret = ff_get_buffer(avctx, frame, 0);



More information about the ffmpeg-cvslog mailing list