diff mbox

[FFmpeg-devel] lavfi/tests: Fix 16-bit vf_blend test to avoid memory not aligned to 2 bytes

Message ID 20180523210736.30556-1-andrey.semashev@gmail.com
State Accepted
Commit d7eb8d84757155c1fb0fe1a8269025e22e9bf0ec
Headers show

Commit Message

Andrey Semashev May 23, 2018, 9:07 p.m. UTC
Generic C implementation of vf_blend performs reads and writes of 16-bit
elements, which requires the buffers to be aligned to at least 2-byte
boundary.

Also, the change fixes source buffer overrun caused by src_offset being
added to to test handling of misaligned buffers.

Fixes: #7226
---
 tests/checkasm/vf_blend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andrey Semashev May 29, 2018, 12:30 p.m. UTC | #1
On 05/24/18 00:07, Andrey Semashev wrote:
> Generic C implementation of vf_blend performs reads and writes of 16-bit
> elements, which requires the buffers to be aligned to at least 2-byte
> boundary.
> 
> Also, the change fixes source buffer overrun caused by src_offset being
> added to to test handling of misaligned buffers.
> 
> Fixes: #7226

Ping? Any comments?

> ---
>   tests/checkasm/vf_blend.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/checkasm/vf_blend.c b/tests/checkasm/vf_blend.c
> index 912f3a2c38..a7578fec39 100644
> --- a/tests/checkasm/vf_blend.c
> +++ b/tests/checkasm/vf_blend.c
> @@ -71,7 +71,7 @@
>           w = WIDTH / depth;                                                                 \
>                                                                                              \
>           for (i = 0; i < BUF_UNITS - 1; i++) {                                              \
> -            int src_offset = i * SIZE_PER_UNIT + i; /* Test various alignments */          \
> +            int src_offset = i * SIZE_PER_UNIT + (BUF_UNITS - 1 - i) * depth; /* Test various alignments */  \
>               int dst_offset = i * SIZE_PER_UNIT; /* dst must be aligned */                  \
>               randomize_buffers();                                                           \
>               call_ref(top1 + src_offset, w, bot1 + src_offset, w,                           \
>
Paul B Mahol May 29, 2018, 12:41 p.m. UTC | #2
On 5/29/18, Andrey Semashev <andrey.semashev@gmail.com> wrote:
> On 05/24/18 00:07, Andrey Semashev wrote:
>> Generic C implementation of vf_blend performs reads and writes of 16-bit
>> elements, which requires the buffers to be aligned to at least 2-byte
>> boundary.
>>
>> Also, the change fixes source buffer overrun caused by src_offset being
>> added to to test handling of misaligned buffers.
>>
>> Fixes: #7226
>
> Ping? Any comments?

Should be OK.
Michael Niedermayer May 29, 2018, 11:40 p.m. UTC | #3
On Tue, May 29, 2018 at 02:41:33PM +0200, Paul B Mahol wrote:
> On 5/29/18, Andrey Semashev <andrey.semashev@gmail.com> wrote:
> > On 05/24/18 00:07, Andrey Semashev wrote:
> >> Generic C implementation of vf_blend performs reads and writes of 16-bit
> >> elements, which requires the buffers to be aligned to at least 2-byte
> >> boundary.
> >>
> >> Also, the change fixes source buffer overrun caused by src_offset being
> >> added to to test handling of misaligned buffers.
> >>
> >> Fixes: #7226
> >
> > Ping? Any comments?
> 
> Should be OK.

will apply unless someone else does before

thx

[...]
diff mbox

Patch

diff --git a/tests/checkasm/vf_blend.c b/tests/checkasm/vf_blend.c
index 912f3a2c38..a7578fec39 100644
--- a/tests/checkasm/vf_blend.c
+++ b/tests/checkasm/vf_blend.c
@@ -71,7 +71,7 @@ 
         w = WIDTH / depth;                                                                 \
                                                                                            \
         for (i = 0; i < BUF_UNITS - 1; i++) {                                              \
-            int src_offset = i * SIZE_PER_UNIT + i; /* Test various alignments */          \
+            int src_offset = i * SIZE_PER_UNIT + (BUF_UNITS - 1 - i) * depth; /* Test various alignments */  \
             int dst_offset = i * SIZE_PER_UNIT; /* dst must be aligned */                  \
             randomize_buffers();                                                           \
             call_ref(top1 + src_offset, w, bot1 + src_offset, w,                           \