From: Timo Rothenpieler via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Timo Rothenpieler <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] avfilter/vf_scale_d3d12: fix integer overflow in input framerate calculation (PR #21130)
Date: Mon, 08 Dec 2025 13:22:11 -0000
Message-ID: <176520013173.39.8057095499015813386@2cb04c0e5124> (raw)
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
reply other threads:[~2025-12-08 13:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=176520013173.39.8057095499015813386@2cb04c0e5124 \
--to=ffmpeg-devel@ffmpeg.org \
--cc=code@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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