Commit 3cbb3a035e for ffmpeg

commit 3cbb3a035e5ede179c5abd700c6bd7b17c02d4ce
Author: Marvin Scholz <epirat07@gmail.com>
Date:   Fri Oct 23 14:29:58 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 <epirat07@gmail.com>

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);