Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Martin Storsjö" <martin@martin.st>
To: Kieran Kunhya via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
Cc: Kieran Kunhya <kieran618@googlemail.com>
Subject: Re: [FFmpeg-devel] [PATCH] checkasm/v210enc.c: Use checkasm_check_type
Date: Mon, 10 Feb 2025 14:40:46 +0200 (EET)
Message-ID: <9f99fb7-7218-e2d4-57fb-be187149cefa@martin.st> (raw)
In-Reply-To: <CABGuwEkJG9zWH=DdKz3QrCa2WGRxw04CScCtRuGgk=5ORmEfBw@mail.gmail.com>

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".

  reply	other threads:[~2025-02-10 12:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-08 16:47 Kieran Kunhya via ffmpeg-devel
2025-02-10 12:40 ` Martin Storsjö [this message]
2025-02-10 12:56   ` Kieran Kunhya via ffmpeg-devel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9f99fb7-7218-e2d4-57fb-be187149cefa@martin.st \
    --to=martin@martin.st \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=kieran618@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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