PR #21130 opened by Timo Rothenpieler (BtbN) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21130 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21130.patch
Also removes pointless intermediate variables that caused the overflow and truncation to happen in the first place. Fixes #YWH-PGM40646-1 >From 338889c0d9794782ea1b247bce934df50e5ade8c Mon Sep 17 00:00:00 2001 From: Timo Rothenpieler <[email protected]> Date: Mon, 8 Dec 2025 14:18:36 +0100 Subject: [PATCH] avfilter/vf_scale_d3d12: fix integer overflow in input framerate calculation Also removes pointless intermediate variables that caused the overflow and truncation to happen in the first place. Fixes #YWH-PGM40646-1 --- libavfilter/vf_scale_d3d12.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/libavfilter/vf_scale_d3d12.c b/libavfilter/vf_scale_d3d12.c index 6950feb32b..8066bd0725 100644 --- a/libavfilter/vf_scale_d3d12.c +++ b/libavfilter/vf_scale_d3d12.c @@ -155,8 +155,6 @@ static DXGI_COLOR_SPACE_TYPE get_dxgi_colorspace(enum AVColorSpace colorspace, e static AVRational get_input_framerate(AVFilterContext *ctx, AVFilterLink *inlink, AVFrame *in) { - int64_t duration_scaled; - int64_t time_base_den; AVRational framerate = {0, 0}; if (in->duration > 0 && inlink->time_base.num > 0 && inlink->time_base.den > 0) { @@ -164,13 +162,9 @@ static AVRational get_input_framerate(AVFilterContext *ctx, AVFilterLink *inlink * Calculate framerate from frame duration and timebase * framerate = 1 / (duration * timebase) */ - duration_scaled = in->duration * inlink->time_base.num; - time_base_den = inlink->time_base.den; - framerate.num = time_base_den; - framerate.den = duration_scaled; - /* Reduce the fraction */ av_reduce(&framerate.num, &framerate.den, - framerate.num, framerate.den, INT_MAX); + inlink->time_base.den, in->duration * inlink->time_base.num, + INT_MAX); } else if (inlink->time_base.num > 0 && inlink->time_base.den > 0) { /* Estimate from timebase (inverse of timebase is often the framerate) */ framerate.num = inlink->time_base.den; -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
