ffmpeg | branch: release/7.0 | Michael Niedermayer <mich...@niedermayer.cc> | 
Thu Apr  4 00:42:20 2024 +0200| [abaa747ee5db942b59f7106bb76e4806ae5cae84] | 
committer: Michael Niedermayer

avformat/pcm: Use 64bit in bitrate computation

Fixes: signed integer overflow: 65792 * 65312 cannot be represented in type 
'int'
Fixes: 
67819/clusterfuzz-testcase-minimized-ffmpeg_dem_WADY_fuzzer-5236100912185344

Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>
(cherry picked from commit bf3b74142e4402912e26b5e58a0b63f87ec3cd21)
Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>

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

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

diff --git a/libavformat/pcm.c b/libavformat/pcm.c
index 051e86dd46..a774dbc372 100644
--- a/libavformat/pcm.c
+++ b/libavformat/pcm.c
@@ -41,7 +41,7 @@ int ff_pcm_default_packet_size(AVCodecParameters *par)
     /* Don't trust the codecpar bitrate if we can calculate it ourselves */
     if (bits_per_sample > 0 && par->sample_rate > 0 && 
par->ch_layout.nb_channels > 0)
         if ((int64_t)par->sample_rate * par->ch_layout.nb_channels < INT64_MAX 
/ bits_per_sample)
-            bitrate = bits_per_sample * par->sample_rate * 
par->ch_layout.nb_channels;
+            bitrate = bits_per_sample * (int64_t)par->sample_rate * 
par->ch_layout.nb_channels;
 
     if (bitrate > 0) {
         nb_samples = av_clip64(bitrate / 8 / PCM_DEMUX_TARGET_FPS / 
par->block_align, 1, max_samples);

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to