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

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 3cbb3a035e avformat/flvdec: prevent float-cast-overflow in 
amf_parse_object
3cbb3a035e is described below

commit 3cbb3a035e5ede179c5abd700c6bd7b17c02d4ce
Author:     Marvin Scholz <[email protected]>
AuthorDate: Fri Oct 23 14:29:58 2026 +0000
Commit:     Marvin Scholz <[email protected]>
CommitDate: Tue Nov 17 03:15:08 2026 +0000

    avformat/flvdec: prevent float-cast-overflow in amf_parse_object
    
    Validate duration, videodatarate, and audiodatarate in
    amf_parse_object() before converting double values to int64_t,
    preventing float-cast-overflow undefined behavior on NaN, negative,
    infinite, or out-of-range values.
    
    Signed-off-by: Marvin Scholz <[email protected]>
---
 libavformat/flvdec.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 29bd7d6754..a4d8610d2c 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -719,13 +719,14 @@ static int amf_parse_object(AVFormatContext *s, AVStream 
*astream,
         if (depth == 1) {
             if (amf_type == AMF_DATA_TYPE_NUMBER ||
                 amf_type == AMF_DATA_TYPE_BOOL) {
-                if (!strcmp(key, "duration"))
+                if (!strcmp(key, "duration") &&
+                    num_val >= 0 && num_val < INT64_MAX / AV_TIME_BASE)
                     s->duration = num_val * AV_TIME_BASE;
                 else if (!strcmp(key, "videodatarate") &&
-                         0 <= (int)(num_val * 1024.0))
+                         0 <= num_val && num_val < INT_MAX / 1024.0)
                     flv->video_bit_rate = num_val * 1024.0;
                 else if (!strcmp(key, "audiodatarate") &&
-                         0 <= (int)(num_val * 1024.0))
+                         0 <= num_val && num_val < INT_MAX / 1024.0)
                     flv->audio_bit_rate = num_val * 1024.0;
                 else if (!strcmp(key, "framerate")) {
                     flv->framerate = av_d2q(num_val, 1000);

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to