From: Hankang Li via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: Hankang Li <hankang201222@gmail.com>
Subject: [FFmpeg-devel] [PATCH] libswscale/output: fix signed integer overflow in yuv2rgba64
Date: Wed, 11 Feb 2026 01:00:42 -0800
Message-ID: <20260211090042.3466410-1-hankang201222@gmail.com> (raw)
Clamp the intermediate alpha value within 19 bits, this prevents
overflow.
Note: This issue is only reproducible with --disable-x86asm. There is an
existing issue in fate-sws-unscaled with --disable-x86asm (ticket
#21113). This change does not introduce any new regressions.
Signed-off-by: Hankang Li <hankang201222@gmail.com>
---
libswscale/output.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libswscale/output.c b/libswscale/output.c
index a3b8da54bf..afb3878170 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -1288,8 +1288,8 @@ yuv2rgba64_1_c_template(SwsInternal *c, const int32_t *buf0,
Y2 += (1 << 13) - (1 << 29);
if (hasAlpha) {
- A1 = abuf0[i * 2 ] * (1 << 11);
- A2 = abuf0[i * 2 + 1] * (1 << 11);
+ A1 = av_clip_uintp2(abuf0[i * 2 ], 19) * (1 << 11);
+ A2 = av_clip_uintp2(abuf0[i * 2 + 1], 19) * (1 << 11);
A1 += 1 << 13;
A2 += 1 << 13;
@@ -1337,8 +1337,8 @@ yuv2rgba64_1_c_template(SwsInternal *c, const int32_t *buf0,
Y2 += (1 << 13) - (1 << 29);
if (hasAlpha) {
- A1 = abuf0[i * 2 ] * (1 << 11);
- A2 = abuf0[i * 2 + 1] * (1 << 11);
+ A1 = av_clip_uintp2(abuf0[i * 2 ], 19) * (1 << 11);
+ A2 = av_clip_uintp2(abuf0[i * 2 + 1], 19) * (1 << 11);
A1 += 1 << 13;
A2 += 1 << 13;
--
2.52.0
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
next reply other threads:[~2026-02-11 15:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-11 9:00 Hankang Li via ffmpeg-devel [this message]
2026-02-13 2:17 ` [FFmpeg-devel] " Michael Niedermayer via ffmpeg-devel
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=20260211090042.3466410-1-hankang201222@gmail.com \
--to=ffmpeg-devel@ffmpeg.org \
--cc=hankang201222@gmail.com \
/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