[FFmpeg-devel] [PATCH v2] compat: Fix the fallback definition of stdc_trailing_zeros

Anton Khirnov anton at khirnov.net
Tue Sep 24 13:18:23 EEST 2024


Quoting Martin Storsjö (2024-09-24 12:13:37)
> While shifting "value" to left, we would iterate through all bits
> of an unsigned long long, while we only expect to count through
> "size * CHAR_BIT" bits; instead shift bits to the right and just
> count the trailing zeros.
> 
> This fixes fate with MSVC.
> ---
> Fixed the UB by shifting to the right instead of to the left.
> ---
>  compat/stdbit/stdbit.h | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)

LGTM

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list