[FFmpeg-devel] [PATCH] tests/checkasm/sw_rgb: don't write random data past the end of the buffer
James Almer
jamrial at gmail.com
Thu Sep 12 15:14:40 EEST 2024
On 9/12/2024 5:16 AM, Ramiro Polla wrote:
> On Thu, Sep 12, 2024 at 8:44 AM James Almer <jamrial at gmail.com> wrote:
>>
>> Should fix fate-checkasm-sw_rgb under gcc-ubsan.
>>
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>> tests/checkasm/sw_rgb.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tests/checkasm/sw_rgb.c b/tests/checkasm/sw_rgb.c
>> index af9434073a..cdd43df8ba 100644
>> --- a/tests/checkasm/sw_rgb.c
>> +++ b/tests/checkasm/sw_rgb.c
>> @@ -287,7 +287,7 @@ static void check_deinterleave_bytes(void)
>> int width, int height, int srcStride,
>> int dst1Stride, int dst2Stride);
>>
>> - randomize_buffers(src, 2*MAX_STRIDE*MAX_HEIGHT+2);
>> + randomize_buffers(src, 2*MAX_STRIDE*MAX_HEIGHT);
>
> Thank you for spotting it.
>
> The issue is that randomize_buffers() writes 4 bytes at a time. I
> think the proper fix is to change randomize_buffers() to not write
> past the end of the buffer. It would be even better to move
2*MAX_STRIDE*MAX_HEIGHT is a multiple of 4 and the exact size of the
available buffer, whereas 2*MAX_STRIDE*MAX_HEIGHT+2 isn't.
> randomize_buffers() to checkasm.h or checkasm.c so it doesn't have to
> be copied around so many times.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240912/7459ced1/attachment.sig>
More information about the ffmpeg-devel
mailing list