From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH 2/4] checkasm: Implement helpers for defining and checking padded rects
Date: Sat, 29 Mar 2025 01:15:10 +0100
Message-ID: <20250329001510.GO4991@pb2> (raw)
In-Reply-To: <20250326103015.44296-2-martin@martin.st>
[-- Attachment #1.1: Type: text/plain, Size: 2254 bytes --]
On Wed, Mar 26, 2025 at 12:30:13PM +0200, Martin Storsjö wrote:
> This backports similar functionality from dav1d, from commits
> 35d1d011fda4a92bcaf42d30ed137583b27d7f6d and
> d130da9c315d5a1d3968d278bbee2238ad9051e7.
>
> This allows detecting writes out of bounds, on all 4 sides of
> the intended destination rectangle.
>
> The bounds checking also can optionally allow small overwrites
> (up to a specified alignment), while still checking for larger
> overwrites past the intended allowed region.
> ---
> tests/checkasm/checkasm.c | 89 ++++++++++++++++++++++++++++++---------
> tests/checkasm/checkasm.h | 55 ++++++++++++++++++++----
> 2 files changed, 116 insertions(+), 28 deletions(-)
>
> diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
> index c6d641c52b..a5b862fe52 100644
> --- a/tests/checkasm/checkasm.c
> +++ b/tests/checkasm/checkasm.c
> @@ -1168,37 +1168,88 @@ void checkasm_report(const char *name, ...)
> }
> }
>
> +static int check_err(const char *file, int line,
> + const char *name, int w, int h,
> + int *err)
> +{
> + if (*err)
> + return 0;
> + if (!checkasm_fail_func("%s:%d", file, line))
> + return 1;
> + *err = 1;
> + fprintf(stderr, "%s (%dx%d):\n", name, w, h);
> + return 0;
> +}
> +
> #define DEF_CHECKASM_CHECK_FUNC(type, fmt) \
> int checkasm_check_##type(const char *file, int line, \
> const type *buf1, ptrdiff_t stride1, \
> const type *buf2, ptrdiff_t stride2, \
> - int w, int h, const char *name) \
> + int w, int h, const char *name, \
> + int align_w, int align_h, \
> + int padding) \
> { \
> + int aligned_w = (w + align_w - 1) & ~(align_w - 1); \
> + int aligned_h = (h + align_h - 1) & ~(align_h - 1); \
this can overflow
feel free to fix in a seperate patch
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: 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".
next prev parent reply other threads:[~2025-03-29 0:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-26 10:30 [FFmpeg-devel] [PATCH 1/4] checkasm: Make checkasm_fail_func return whether we should print verbosely Martin Storsjö
2025-03-26 10:30 ` [FFmpeg-devel] [PATCH 2/4] checkasm: Implement helpers for defining and checking padded rects Martin Storsjö
2025-03-29 0:15 ` Michael Niedermayer [this message]
2025-03-31 13:05 ` Martin Storsjö
2025-04-01 0:28 ` Michael Niedermayer
2025-04-01 9:38 ` Martin Storsjö
2025-04-01 15:38 ` Martin Storsjö
2025-03-26 10:30 ` [FFmpeg-devel] [PATCH 3/4] checkasm: hevc_pel: Use helpers for checking for writes out of bounds Martin Storsjö
2025-04-01 9:35 ` Martin Storsjö
2025-04-01 12:54 ` yinshiyou-hf
2025-04-10 10:36 ` Martin Storsjö
2025-03-26 10:30 ` [FFmpeg-devel] [PATCH 4/4] checkasm: vp8dsp: Use checkasm_check_padded in check_mc Martin Storsjö
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=20250329001510.GO4991@pb2 \
--to=michael@niedermayer.cc \
--cc=ffmpeg-devel@ffmpeg.org \
/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