Commit ef118f5e4c for ffmpeg

commit ef118f5e4ca37f1b53b0e3486a62988b99d33757
Author: Michael Niedermayer <michael@niedermayer.cc>
Date:   Tue Nov 17 04:13:08 2026 +0100

    avfilter/vf_deflicker: limit the factor and the scaled samples before the integer conversion

    The factor is infinite or NaN when the average luma of a frame is 0.
    A factor above the maximum sample value gives the same output as the
    maximum sample value.

    Fixes: -nan is outside the range of representable values of type 'int'
    Fixes: g08Dzsg95lYL

    Found during triage of the security report AISLE-2026-R0057

    Undefined float to integer conversion Replicated through UnModified FFmpeg with UBSAN

diff --git a/libavfilter/vf_deflicker.c b/libavfilter/vf_deflicker.c
index 8bab1211c2..d802ed3a4d 100644
--- a/libavfilter/vf_deflicker.c
+++ b/libavfilter/vf_deflicker.c
@@ -146,7 +146,7 @@ static int deflicker16(AVFilterContext *ctx,

     for (y = 0; y < h; y++) {
         for (x = 0; x < w; x++) {
-            dst[x] = av_clip(src[x] * f, 0, max);
+            dst[x] = FFMIN(src[x] * f, max);
         }

         dst += dst_linesize / 2;
@@ -378,7 +378,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
     s->get_factor(ctx, &f);
     if (!s->bypass)
         s->deflicker(ctx, in->data[0], in->linesize[0], out->data[0], out->linesize[0],
-                     outlink->w, outlink->h, f);
+                     outlink->w, outlink->h, av_clipf(f, 0, (1 << s->depth) - 1));
     for (y = 1 - s->bypass; y < s->nb_planes; y++) {
         av_image_copy_plane(out->data[y], out->linesize[y],
                             in->data[y], in->linesize[y],