[FFmpeg-devel] [PATCH] checkasm/v210enc.c: Use checkasm_check_type
Martin Storsjö
martin at martin.st
Mon Feb 10 14:40:46 EET 2025
On Sat, 8 Feb 2025, Kieran Kunhya via ffmpeg-devel wrote:
> $subj
> - if (memcmp(y0, y1, BUF_SIZE * sizeof(type)) \
> - || memcmp(u0, u1, BUF_SIZE * sizeof(type) / 2) \
> - || memcmp(v0, v1, BUF_SIZE * sizeof(type) / 2) \
> - || memcmp(dst0, dst1, width * 8 / 3)) \
> + if (checkasm_check_##type(NULL, 0, y0, 0, y1, 0, BUF_SIZE, 0, NULL) \
> + || checkasm_check_##type(NULL, 0, u0, 0, u1, 0, BUF_SIZE / 2, 0, NULL) \
> + || checkasm_check_##type(NULL, 0, v0, 0, v1, 0, BUF_SIZE / 2, 0, NULL) \
> + || checkasm_check_uint8_t(NULL, 0, dst0, 0, dst1, 0, (width * 8 / 3), 0, NULL)) \
This actually doesn't detect any failures at all; you're passing it
parameters for checking a buffer of BUF_SIZE width and 0 height, so it
doesn't check anything.
By passing height 1, it does seem to work as intended (detecting an
intentionally added error in the asm).
It feels a little bit unwieldy to check (and print out, if checkasm is run
with "-v") the whole BUF_SIZE, but it's good to have testing for potential
writes out of bounds at least, like before.
Further in dav1d there are more improvements to these checkasm helpers,
which we haven't backported to ffmpeg yet, that helps with allocating
padded buffers and checking that the padding isn't overwritten; that would
allow reducing the size of the checked area, to make it easier to read on
errors too.
But until that's backported, I guess this is fine, if you change the
height to 1.
// Martin
More information about the ffmpeg-devel
mailing list