Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] checkasm/v210enc.c: Use checkasm_check_type
@ 2025-02-08 16:47 Kieran Kunhya via ffmpeg-devel
  2025-02-10 12:40 ` Martin Storsjö
  0 siblings, 1 reply; 3+ messages in thread
From: Kieran Kunhya via ffmpeg-devel @ 2025-02-08 16:47 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Kieran Kunhya

[-- Attachment #1: Type: text/plain, Size: 6 bytes --]

$subj

[-- Attachment #2: 0001-checkasm-v210enc.c-Use-checkasm_check_type.patch --]
[-- Type: application/octet-stream, Size: 1767 bytes --]

[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH] checkasm/v210enc.c: Use checkasm_check_type
  2025-02-08 16:47 [FFmpeg-devel] [PATCH] checkasm/v210enc.c: Use checkasm_check_type Kieran Kunhya via ffmpeg-devel
@ 2025-02-10 12:40 ` Martin Storsjö
  2025-02-10 12:56   ` Kieran Kunhya via ffmpeg-devel
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Storsjö @ 2025-02-10 12:40 UTC (permalink / raw)
  To: Kieran Kunhya via ffmpeg-devel; +Cc: Kieran Kunhya

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

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH] checkasm/v210enc.c: Use checkasm_check_type
  2025-02-10 12:40 ` Martin Storsjö
@ 2025-02-10 12:56   ` Kieran Kunhya via ffmpeg-devel
  0 siblings, 0 replies; 3+ messages in thread
From: Kieran Kunhya via ffmpeg-devel @ 2025-02-10 12:56 UTC (permalink / raw)
  To: Martin Storsjö; +Cc: Kieran Kunhya, Kieran Kunhya via ffmpeg-devel

On Mon, Feb 10, 2025 at 12:40 PM Martin Storsjö <martin@martin.st> wrote:
>
> 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
>

Sorry yes I had that fixed locally. I also noticed it was a lot of
data to print the whole BUF_SIZE.

Kieran
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-02-10 12:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-08 16:47 [FFmpeg-devel] [PATCH] checkasm/v210enc.c: Use checkasm_check_type Kieran Kunhya via ffmpeg-devel
2025-02-10 12:40 ` Martin Storsjö
2025-02-10 12:56   ` Kieran Kunhya via ffmpeg-devel

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git