[FFmpeg-cvslog] avcodec/pcm-dvdenc: 64bit pkt-size

Michael Niedermayer git at videolan.org
Thu Jun 13 23:42:00 EEST 2024


ffmpeg | branch: release/5.1 | Michael Niedermayer <michael at niedermayer.cc> | Mon May 13 01:14:21 2024 +0200| [206816e91546ead0fd90cbecb7422bdf9004d68e] | committer: Michael Niedermayer

avcodec/pcm-dvdenc: 64bit pkt-size

It seems nothing prevents such overflow even though odd

Fixes: CID1441934 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 160b81ce2a87b0835125da7c72ab7ed8c0918c45)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavcodec/pcm-dvdenc.c b/libavcodec/pcm-dvdenc.c
index 0881697c17..6aa05f22f6 100644
--- a/libavcodec/pcm-dvdenc.c
+++ b/libavcodec/pcm-dvdenc.c
@@ -117,7 +117,7 @@ static int pcm_dvd_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
 {
     PCMDVDContext *s = avctx->priv_data;
     int samples = frame->nb_samples * avctx->ch_layout.nb_channels;
-    int64_t pkt_size = (frame->nb_samples / s->samples_per_block) * s->block_size + 3;
+    int64_t pkt_size = (int64_t)(frame->nb_samples / s->samples_per_block) * s->block_size + 3;
     int blocks = (pkt_size - 3) / s->block_size;
     const int16_t *src16;
     const int32_t *src32;



More information about the ffmpeg-cvslog mailing list