[FFmpeg-devel] [PATCH 1/2] tests/checkasm/blockdsp: Fix unaligned stores

James Almer jamrial at gmail.com
Tue May 7 17:36:09 EEST 2024


On 5/7/2024 7:29 AM, Andreas Rheinhardt wrote:
> Fixes this test with UBSan (and maybe also on arches on which
> unaligned stores trap).
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> ---
>   tests/checkasm/blockdsp.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tests/checkasm/blockdsp.c b/tests/checkasm/blockdsp.c
> index 19d69b8687..f6f25f773e 100644
> --- a/tests/checkasm/blockdsp.c
> +++ b/tests/checkasm/blockdsp.c
> @@ -36,8 +36,7 @@ typedef struct {
>   
>   #define randomize_buffers(size)             \
>       do {                                    \
> -        int i;                              \
> -        for (i = 0; i < size; i++) {        \
> +        for (int i = 0; i < size; i += 2) { \
>               uint16_t r = rnd();             \
>               AV_WN16A(buf0 + i, r);          \
>               AV_WN16A(buf1 + i, r);          \

This is incorrect when buf0 and buf1 are uint16_t arrays, as is the case 
for the clear_block tests.
This function doesn't need to be called for fill_block_tab, hence my fix 
using memset.


More information about the ffmpeg-devel mailing list