* [FFmpeg-devel] [PATCH] avfilter/vf_scale_d3d12: fix integer overflow in input framerate calculation (PR #21130)
@ 2025-12-08 13:22 Timo Rothenpieler via ffmpeg-devel
0 siblings, 0 replies; only message in thread
From: Timo Rothenpieler via ffmpeg-devel @ 2025-12-08 13:22 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Timo Rothenpieler
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 <timo@rothenpieler.org>
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 -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-12-08 13:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-08 13:22 [FFmpeg-devel] [PATCH] avfilter/vf_scale_d3d12: fix integer overflow in input framerate calculation (PR #21130) Timo Rothenpieler via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git