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 242254BEBD
	for <ffmpegdev@gitmailbox.com>; Mon, 31 Mar 2025 13:05:41 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AEE24687CC8;
	Mon, 31 Mar 2025 16:05:37 +0300 (EEST)
Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com
 [209.85.167.43])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1DA50687BFE
 for <ffmpeg-devel@ffmpeg.org>; Mon, 31 Mar 2025 16:05:31 +0300 (EEST)
Received: by mail-lf1-f43.google.com with SMTP id
 2adb3069b0e04-54af09697f5so4332030e87.1
 for <ffmpeg-devel@ffmpeg.org>; Mon, 31 Mar 2025 06:05:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=martin-st.20230601.gappssmtp.com; s=20230601; t=1743426330; x=1744031130;
 darn=ffmpeg.org; 
 h=mime-version:references:message-id:in-reply-to:subject:to:from:date
 :from:to:cc:subject:date:message-id:reply-to;
 bh=FTdwwPmGWcCWK9ElDtNdF655QloPbktfTe+buILdZFs=;
 b=K2qy8FDcjEXEJaQ8CNQnjOfkt1GJvo4o12gg1mDJnzo17c7eW3MK4xr/qdDpB+bWYg
 P8xHUr4Wv1P/yA6MOK90Bn8NGZ9mmGnzEwle4x/+sjmlY6rZzIgLop/0qRd8qveFuFSk
 XNUIslcaDFr8O1BHjRprmo0qZKN4I88HXQTTZ5kpegI1AV9LDqnoR5rlCndNSC38MHXA
 0FGsKkt2tSp2fcIQceOIbKNQO0xzn0KouD9etVwvPlTgHaKMa9quQFoECfjLFFjnhNDU
 HVSv97CzXvw3U5Nyc1pGv/Uonf7qmqrUezabZC0qteLQWAhkum8qgtcGUKvkWYK+EMck
 rwMQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1743426330; x=1744031130;
 h=mime-version:references:message-id:in-reply-to:subject:to:from:date
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=FTdwwPmGWcCWK9ElDtNdF655QloPbktfTe+buILdZFs=;
 b=a82VKlCM0Xyc8QIXa3Y+2yRC+wlapevYPy2KJhEbQZthLkQtnSQLAIP054iK4aAVKP
 iwGn3HMMAJ0FwE4O2oNe+1Azb/OhObtDAe362ECoh2BDqjjOPxqdUYzRzqzd+9qyt5ws
 aRjEXQJ49xqw7HuWs5EaZixHtvClhLa3BESdETavxJ3YDIo+pXNnSAs02n85nQ9KeLgL
 ZPwv3ciW+eGJUZnlS3JrJbLvCEK6wVNRB6MiKkJ6sk+qXP0Nq0uuhd9k0iUBBo+/g6BR
 23JklEvyYZWGMye/cp4mlWKkAWsb4AY0aki+qNaKEQKC3cP+O4fKPF5/TqTJl4kxrJtL
 Fylg==
X-Gm-Message-State: AOJu0YxFqV+Akc3cnGpEUS0oeE/qtT8LM9Ln+mGFBSxaOq5CP2GctPyW
 jUDd8y+VwMTUpZMYjWErC1Fs51WeTQCTVGBMmNt2JbWBo7Xum/KXc/WZhq8wZ1higR1HNRO2GK3
 dng==
X-Gm-Gg: ASbGncsbtcJrkc7qyR4t7CeanKn32RA+xdxnDZYGmmBFyl86q8/ZNT0AizpmOMHzNwM
 aFMCQJvNqbwS0rHyK0L+oawk1YHxEORX4NCEZCW1PAj99jXES/OfCcG/1Z3XFjzSpnEIUsRC440
 orqAQiJmibpilMlJ8GJd0vM64xGACbdbRgZrvvJwygDbEIu0WGuLP+oeg4aGIMnaAO6fqSlkc40
 MR+MGHDd30ikwifJSTHinAhBktNM1FYSRLuRb5X6UmcZaxsaL2RTbzKZVGReVomlj3SzVzo38NX
 LGwAHRIcDjH0jssOcTab1tgYYTUS8ptAKLMzrfExEmXtne9L1DencqdhrKIVFc3PE7wWS66QI1N
 BsZLoDJvqFSok4elO/7RNFCkJriYU+43rV2rhWbAm
X-Google-Smtp-Source: AGHT+IF2D3Y+QrPuHj4LJBnjd8Rfv4edtxRb+I8F/pANg8nvxjgREXZtjauInB0kCQzZRGL2Bb9Ygw==
X-Received: by 2002:a05:6512:1326:b0:54b:1055:f4bb with SMTP id
 2adb3069b0e04-54b10dbcc01mr2746991e87.4.1743426329244; 
 Mon, 31 Mar 2025 06:05:29 -0700 (PDT)
Received: from tunnel335574-pt.tunnel.tserv24.sto1.ipv6.he.net
 (tunnel335574-pt.tunnel.tserv24.sto1.ipv6.he.net. [2001:470:27:11::2])
 by smtp.gmail.com with ESMTPSA id
 2adb3069b0e04-54b094baec7sm1158866e87.8.2025.03.31.06.05.28
 for <ffmpeg-devel@ffmpeg.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 31 Mar 2025 06:05:28 -0700 (PDT)
Date: Mon, 31 Mar 2025 16:05:27 +0300 (EEST)
From: =?ISO-8859-15?Q?Martin_Storsj=F6?= <martin@martin.st>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
In-Reply-To: <20250329001510.GO4991@pb2>
Message-ID: <2642b04-6ac-a238-c3f2-1551a5e5d4c@martin.st>
References: <20250326103015.44296-1-martin@martin.st>
 <20250326103015.44296-2-martin@martin.st> <20250329001510.GO4991@pb2>
MIME-Version: 1.0
X-Content-Filtered-By: Mailman/MimeDel 2.1.29
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-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/2642b04-6ac-a238-c3f2-1551a5e5d4c@martin.st/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>

On Sat, 29 Mar 2025, Michael Niedermayer wrote:

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

Feel free to propose a patch for how you'd prefer to have it fixed then... =

I don't see this as a real world problem - w and h are bounded by the =

tests themselves, and likewise the alignments - I don't see us having =

tests using buffers with a width near INT32_MAX?

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