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

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue May 7 14:13:57 EEST 2024


Andreas Rheinhardt:
> 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);          \

On second thought, this test seems even more broken: It only randomizes
size bytes (or size + 1 bytes on master), but the actual block
dimensions are size x size. Had size x size bytes been randomized, there
would have been a stack buffer overflow.

- Andreas



More information about the ffmpeg-devel mailing list