Commit f91b54fbe3 for ffmpeg
commit f91b54fbe3fdbb4e9c5bb82735c329012d1fa27c
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Fri Oct 16 22:21:59 2026 +0200
avcodec/libaribcaption: make the default alpha values unsigned
ARIBCC_MAKE_RGBA() shifts the alpha value left by 24 bits, which does
not fit in an int for the defaults 0xFF and 0x80.
Fixes: libavcodec/libaribcaption.c:650:37: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'
Fixes: undefined shift
Undefined shift Replicated through UnModified FFmpeg with UBSAN
Found during triage/review of the security report AISLE-2026-R0043 (AISLE-2026-0150-00333, 6vQDuOhjPDP6)
diff --git a/libavcodec/libaribcaption.c b/libavcodec/libaribcaption.c
index e8f7cada73..340e8866f8 100644
--- a/libavcodec/libaribcaption.c
+++ b/libavcodec/libaribcaption.c
@@ -39,8 +39,8 @@
#define ARIBC_BPRINT_SIZE_INIT 64
#define ARIBC_BPRINT_SIZE_MAX (8 * 1024)
#define ARIBC_ALPHA_MAX_NUM 4
-#define ARIBC_ALPHA_DEFAULT_FRONT 0xFF
-#define ARIBC_ALPHA_DEFAULT_BACK 0x80
+#define ARIBC_ALPHA_DEFAULT_FRONT 0xFFu
+#define ARIBC_ALPHA_DEFAULT_BACK 0x80u
#define ARIBCC_COLOR_RGB(c) ((c) & 0xFFFFFF)
#define ARIBCC_COLOR_DIFF_RGB(c1,c2) (((c1) ^ (c2)) & 0x00FFFFFF)