This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 6084f07189dbe38eff69bbfac2e5a4d36d644bf6
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Sun Feb 22 17:30:32 2026 +0100
Commit:     Michael Niedermayer <[email protected]>
CommitDate: Fri Mar 6 23:08:03 2026 +0100

    avcodec/utils: fix duration computation based on frame_bytes
    
    Fixes: signed integer overflow: 256 * 8396351 cannot be represented in type 
'int'
    Fixes: 
482692578/clusterfuzz-testcase-minimized-ffmpeg_dem_SWF_fuzzer-5865521093607424
    
    Found-by: continuous fuzzing process 
https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
    Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavcodec/utils.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index d89e886a08..615d60cd58 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -641,16 +641,16 @@ static int get_audio_frame_duration(enum AVCodecID id, 
int sr, int ch, int ba,
 
     if (frame_bytes > 0) {
         /* calc from frame_bytes only */
-        if (id == AV_CODEC_ID_TRUESPEECH)
-            return 240 * (frame_bytes / 32);
-        if (id == AV_CODEC_ID_NELLYMOSER)
-            return 256 * (frame_bytes / 64);
-        if (id == AV_CODEC_ID_RA_144)
-            return 160 * (frame_bytes / 20);
-        if (id == AV_CODEC_ID_APTX)
-            return 4 * (frame_bytes / 4);
-        if (id == AV_CODEC_ID_APTX_HD)
-            return 4 * (frame_bytes / 6);
+        int64_t d = INT64_MIN;
+        switch(id) {
+        case AV_CODEC_ID_TRUESPEECH : d = 240LL * (frame_bytes / 32); break;
+        case AV_CODEC_ID_NELLYMOSER : d = 256LL * (frame_bytes / 64); break;
+        case AV_CODEC_ID_RA_144     : d = 160LL * (frame_bytes / 20); break;
+        case AV_CODEC_ID_APTX       : d =   4LL * (frame_bytes /  4); break;
+        case AV_CODEC_ID_APTX_HD    : d =   4LL * (frame_bytes /  6); break;
+        }
+        if (d > INT64_MIN)
+            return ((int)d == d && d > 0) ? d : 0;
 
         if (bps > 0) {
             /* calc from frame_bytes and bits_per_coded_sample */

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to