PR #26127 opened by Zhao Zhili (quink) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26127 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26127.patch
Sanitizer builds are compiled with -fno-omit-frame-pointer. Together with AddressSanitizer's instrumentation of the locals, this leaves too few general-purpose registers on x86-64 for the operand constraints of decode_significance_x86 and decode_significance_8x8_x86 in unoptimized builds, and the compiler rejects the inline assembly. Inline assembly is not instrumented, so it brings no sanitizer coverage. Use the C implementation of the significance decoders in sanitizer builds instead. Regression since cd8d538fe7 # Summary of changes Briefly describe what this PR does and why. <!-- If this PR requires new FATE test samples, attach them to the PR and list their target paths below (relative to the fate-suite root). Attached filenames must match the sample's filename: ```fate-samples # e.g. vorbis/new-sample.ogg ``` --> >From 0b41806173cc3ba5318c93d6eaf06d5ef1c2264b Mon Sep 17 00:00:00 2001 From: Zhao Zhili <[email protected]> Date: Tue, 17 Nov 2026 15:58:28 +0800 Subject: [PATCH] avcodec/x86/cabac: fix build with AddressSanitizer Sanitizer builds are compiled with -fno-omit-frame-pointer. Together with AddressSanitizer's instrumentation of the locals, this leaves too few general-purpose registers on x86-64 for the operand constraints of decode_significance_x86 and decode_significance_8x8_x86 in unoptimized builds, and the compiler rejects the inline assembly. Inline assembly is not instrumented, so it brings no sanitizer coverage. Use the C implementation of the significance decoders in sanitizer builds instead. Regression since cd8d538fe7 --- libavcodec/x86/h264_cabac.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavcodec/x86/h264_cabac.c b/libavcodec/x86/h264_cabac.c index 734879dbd6f..48beba0cb5a 100644 --- a/libavcodec/x86/h264_cabac.c +++ b/libavcodec/x86/h264_cabac.c @@ -29,6 +29,7 @@ #include <stddef.h> #include "libavcodec/cabac.h" +#include "libavutil/sanitizer.h" #include "cabac.h" #if HAVE_INLINE_ASM @@ -41,7 +42,12 @@ //FIXME use some macros to avoid duplicating get_cabac (cannot be done yet //as that would make optimization work hard) -#if HAVE_X86_7REGS && !BROKEN_COMPILER +/* AddressSanitizer builds keep a frame pointer and place every local in + * one instrumented stack frame, so each memory operand of the asm below + * needs its own address register. Unoptimized builds then run out of + * registers. Inline asm is not instrumented anyway, so use the C version. + */ +#if HAVE_X86_7REGS && !BROKEN_COMPILER && !HAVE_ASAN #define decode_significance decode_significance_x86 static int decode_significance_x86(CABACContext *c, int max_coeff, uint8_t *significant_coeff_ctx_base, -- 2.54.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
