From ae6c050a4fb5ae86e25cc4f0350e2cb66fb5851b Mon Sep 17 00:00:00 2001 From: Christian Ebner Date: Wed, 18 Sep 2024 17:00:47 +0200 Subject: [PATCH] decoder: fix incorrect accounting for header in payload input Payload entries are separated by headers of type PAYLOAD within the payload stream of split pxar archives, used for consistency checks when accessing the file contents via a reader instance. Commit 5b8204d0 moved these consistency checks, so they only happen when actually accessing the content, thereby drastically improving performance when navigating contents via the metadata archive. The commit however also incorrectly increased the `Decoder`s `payload_consumed` field by the size of the header, in case the file payload has not been accessed by the `content_reader`. As this filed is used to account for consumed bytes while sequentially reading to possibly skip over entries, this leads to incorrectly skipping of bytes in the stream (less than required). The main manifestation being that a pxar extract with provided match pattern failed. Therefore, drop the incorrect accounting of the payload header. Fixes: 5b8204d0 ("decoder: move payload header check for split input") Signed-off-by: Christian Ebner --- src/decoder/mod.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/decoder/mod.rs b/src/decoder/mod.rs index 6191627..613ec12 100644 --- a/src/decoder/mod.rs +++ b/src/decoder/mod.rs @@ -299,14 +299,9 @@ impl DecoderImpl { } State::InPayload { offset, - header_checked, .. } => { if self.input.payload().is_some() { - if !header_checked { - // header is only checked if payload has been accessed - self.payload_consumed += size_of::
() as u64; - } // Update consumed payload as given by the offset referenced by the content reader self.payload_consumed += offset; } else {