Commit 4934b28a58 for ffmpeg

commit 4934b28a58f55e254cb89d464bbfcff56d657eb3
Author: Marvin Scholz <epirat07@gmail.com>
Date:   Thu Oct 29 22:02:19 2026 +0000

    avformat/sbgdec: fix float cast overflow

    When parsing crafted SBG scripts containing 'NAN', strtod() returns NaN.
    When scaled, m evaluates to NaN. Relational comparisons against NaN
    evaluate to false, so m bypassed the range validation and was cast to
    int, triggering undefined behavior (float-cast-overflow).

    Validate with isnan(m) to prevent NaN from being cast to integer.

    Signed-off-by: Marvin Scholz <epirat07@gmail.com>

diff --git a/libavformat/sbgdec.c b/libavformat/sbgdec.c
index c1ba1dd408..93003bca56 100644
--- a/libavformat/sbgdec.c
+++ b/libavformat/sbgdec.c
@@ -217,9 +217,9 @@ static inline int is_space(char c)
 static inline int scale_double(void *log, double d, double m, int *r)
 {
     m *= d * SBG_SCALE;
-    if (m < INT_MIN || m >= INT_MAX) {
+    if (isnan(m) || m < INT_MIN || m >= INT_MAX) {
         if (log)
-            av_log(log, AV_LOG_ERROR, "%g is too large\n", d);
+            av_log(log, AV_LOG_ERROR, "%g is %s\n", d, isnan(m) ? "not a valid number" : "too large");
         return AVERROR(EDOM);
     }
     *r = m;