Message ID | GV1P250MB073765A0B17ED3AC4AE5E7D88FE42@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM |
---|---|
State | Withdrawn |
Headers | show |
Series | [FFmpeg-devel,1/2] tests/checkasm/blockdsp: Fix unaligned stores | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
Andreas Rheinhardt: > Fixes this test with UBSan (and maybe also on arches on which > unaligned stores trap). > > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@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
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@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.
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); \
Fixes this test with UBSan (and maybe also on arches on which unaligned stores trap). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- tests/checkasm/blockdsp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)