From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ffmpeg-devel-bounces@ffmpeg.org>
Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100])
	by master.gitmailbox.com (Postfix) with ESMTPS id 414D44B844
	for <ffmpegdev@gitmailbox.com>; Sat, 29 Mar 2025 00:15:23 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3512B687C57;
	Sat, 29 Mar 2025 02:15:19 +0200 (EET)
Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net
 [217.70.183.199])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D3144687BC1
 for <ffmpeg-devel@ffmpeg.org>; Sat, 29 Mar 2025 02:15:11 +0200 (EET)
Received: by mail.gandi.net (Postfix) with ESMTPSA id 2DA5743290
 for <ffmpeg-devel@ffmpeg.org>; Sat, 29 Mar 2025 00:15:10 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc;
 s=gm1; t=1743207311;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=h32vNjHqH6mrt0MJF8T4mN++esHWIWQ/XRvgzOUmEgU=;
 b=QXS4pAn2WNH1Ome8tvZjKdcbpCoGa5wlIkLYwFql1vM++C2olbyF9qwIRStmM1IAEpMXQL
 3Fj7nv1wt/FxOicjvt9KwHuKQxmRcGuohxTEy964fpRdJF6IDsbz8emVJGAmILVl4jnGFz
 DRgPMflX/4Gk5LUkUNi0hoobsNriQgPFDodwukM/WS64LKuYDDDk7KsN+LYlhPsOLE8IJL
 Zkk1oT04eAKKLjMVTf4JcHj5FXj+a6oco0aeGZZRJxInpcljZV+X7af+YCaYA+dXM39Xat
 VfiRPKgH1GFU3n1432lj4zQdAoy9oxxcVVqAUE/cCSAakRdCyChVx7o2Ll12ow==
Date: Sat, 29 Mar 2025 01:15:10 +0100
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Message-ID: <20250329001510.GO4991@pb2>
References: <20250326103015.44296-1-martin@martin.st>
 <20250326103015.44296-2-martin@martin.st>
MIME-Version: 1.0
In-Reply-To: <20250326103015.44296-2-martin@martin.st>
X-GND-State: clean
X-GND-Score: -70
X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddujedvjedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuifetpfffkfdpucggtfgfnhhsuhgsshgtrhhisggvnecuuegrihhlohhuthemuceftddunecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenfghrlhcuvffnffculdeftddmnecujfgurhepfffhvffukfhfgggtuggjsehgtderredttddunecuhfhrohhmpefoihgthhgrvghlucfpihgvuggvrhhmrgihvghruceomhhitghhrggvlhesnhhivgguvghrmhgrhigvrhdrtggtqeenucggtffrrghtthgvrhhnpedutedvhfduuedugedufefghefhvedvgffgffekhfdvgfdvtefftdejkeehteefheenucfkphepgedurdeiiedrieejrdduudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieejrdduudefpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg
X-GND-Sasl: michael@niedermayer.cc
Subject: Re: [FFmpeg-devel] [PATCH 2/4] checkasm: Implement helpers for
 defining and checking padded rects
X-BeenThere: ffmpeg-devel@ffmpeg.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org>
List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe>
List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel>
List-Post: <mailto:ffmpeg-devel@ffmpeg.org>
List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help>
List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Content-Type: multipart/mixed; boundary="===============3173959808642944094=="
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/20250329001510.GO4991@pb2/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>


--===============3173959808642944094==
Content-Type: multipart/signed; micalg=pgp-sha512;
	protocol="application/pgp-signature"; boundary="TIDOyVhdVYV5ETol"
Content-Disposition: inline


--TIDOyVhdVYV5ETol
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Mar 26, 2025 at 12:30:13PM +0200, Martin Storsj=F6 wrote:
> This backports similar functionality from dav1d, from commits
> 35d1d011fda4a92bcaf42d30ed137583b27d7f6d and
> d130da9c315d5a1d3968d278bbee2238ad9051e7.
>=20
> This allows detecting writes out of bounds, on all 4 sides of
> the intended destination rectangle.
>=20
> 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(-)
>=20
> 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, ...)
>      }
>  }
> =20
> +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 =3D 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 =3D (w + align_w - 1) & ~(align_w - 1); \
> +    int aligned_h =3D (h + align_h - 1) & ~(align_h - 1); \

this can overflow
feel free to fix in a seperate patch

thx

[...]
--=20
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

--TIDOyVhdVYV5ETol
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZ+c7hgAKCRBhHseHBAsP
q+q8AKCV1sctUc9gZkjjP6qnQKrjgqtW6QCeObz/oyUcsRwgXafskCiK8Zx2ekA=
=FtXx
-----END PGP SIGNATURE-----

--TIDOyVhdVYV5ETol--

--===============3173959808642944094==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

--===============3173959808642944094==--