From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <c.ebner@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id ACA6B9163C
 for <pbs-devel@lists.proxmox.com>; Thu,  4 Apr 2024 11:49:22 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 8DF4835F1C
 for <pbs-devel@lists.proxmox.com>; Thu,  4 Apr 2024 11:49:22 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pbs-devel@lists.proxmox.com>; Thu,  4 Apr 2024 11:49:21 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id B8D3945216
 for <pbs-devel@lists.proxmox.com>; Thu,  4 Apr 2024 11:49:21 +0200 (CEST)
Message-ID: <dd0dca93-c9fa-4258-99ed-cf5ea75d1f9f@proxmox.com>
Date: Thu, 4 Apr 2024 11:49:20 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
To: =?UTF-8?Q?Fabian_Gr=C3=BCnbichler?= <f.gruenbichler@proxmox.com>,
 Proxmox Backup Server development discussion <pbs-devel@lists.proxmox.com>
References: <20240328123707.336951-1-c.ebner@proxmox.com>
 <20240328123707.336951-8-c.ebner@proxmox.com>
 <1712138653.sp8y5k19rp.astroid@yuna.none>
 <a61a16a3-65f7-4aec-b3bc-90b8d2c5c1bb@proxmox.com>
 <1712219444.zzwibroi02.astroid@yuna.none>
Content-Language: en-US, de-DE
From: Christian Ebner <c.ebner@proxmox.com>
In-Reply-To: <1712219444.zzwibroi02.astroid@yuna.none>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.030 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: Re: [pbs-devel] [PATCH v3 pxar 07/58] decoder/accessor: add
 optional payload input stream
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Thu, 04 Apr 2024 09:49:22 -0000

On 4/4/24 10:46, Fabian Grünbichler wrote:
> On April 3, 2024 2:18 pm, Christian Ebner wrote:
>> On 4/3/24 12:38, Fabian Grünbichler wrote:
>>>> +
>>>> +                if let Some(payload_input) = self.payload_input.as_mut() {
>>>
>>> this condition (cted below)
>>>
>>>> +                    if seq_read_position(payload_input)
>>>> +                        .await
>>>> +                        .transpose()?
>>>> +                        .is_none()
>>>> +                    {
>>>> +                        // Skip payload padding for injected chunks in sequential decoder
>>>> +                        let to_skip = payload_ref.offset - self.payload_consumed;
>>>
>>> should we add a check here for the invariant that offsets should only
>>> ever be increasing? (and avoid an underflow for corrupt/invalid archives
>>> ;))
>>
>> This is called by both, seq and random access decoder instances, so that
>> will not be possible I guess.
> 
> but.. payload_consumed only ever goes up? if the offset then jumps back
> to a position before the payload_consumed counter, this will underflow
> (to_skip is unsigned)?

Ah yes, will add the check for just the sequential decoder case...