From d56b676ee94e2c177ffd9e89f79b0feed243013f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 17 Mar 2026 12:25:29 +0000 Subject: [PATCH] fix: increase RewindableBufferSize to 160KB to cover ZStandard worst-case first block Co-authored-by: adamhathcock <527620+adamhathcock@users.noreply.github.com> --- src/SharpCompress/Common/Constants.cs | 6 ++++-- src/SharpCompress/Readers/ReaderOptions.cs | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/SharpCompress/Common/Constants.cs b/src/SharpCompress/Common/Constants.cs index 5fba5ed9..9812501d 100644 --- a/src/SharpCompress/Common/Constants.cs +++ b/src/SharpCompress/Common/Constants.cs @@ -22,7 +22,9 @@ public static class Constants /// by rewinding and re-reading the same data. /// /// - /// Default: 81920 bytes (81KB) - sufficient for typical format detection. + /// Default: 163840 bytes (160KB) - sized to cover ZStandard's worst-case + /// first block on a tar archive (~131KB including frame header overhead). + /// ZStandard blocks can be up to 128KB, exceeding the previous 81KB default. /// /// /// Typical usage: 500-1000 bytes for most archives @@ -39,7 +41,7 @@ public static class Constants /// /// /// - public static int RewindableBufferSize { get; set; } = 81920; + public static int RewindableBufferSize { get; set; } = 163840; public static CultureInfo DefaultCultureInfo { get; set; } = CultureInfo.InvariantCulture; } diff --git a/src/SharpCompress/Readers/ReaderOptions.cs b/src/SharpCompress/Readers/ReaderOptions.cs index dd384d2d..6a063611 100644 --- a/src/SharpCompress/Readers/ReaderOptions.cs +++ b/src/SharpCompress/Readers/ReaderOptions.cs @@ -76,7 +76,8 @@ public sealed record ReaderOptions : IReaderOptions /// by rewinding and re-reading the same data. /// /// - /// Default: Constants.RewindableBufferSize (81920 bytes / 81KB) + /// Default: Constants.RewindableBufferSize (163840 bytes / 160KB) - sized to cover + /// ZStandard's worst-case first block on a tar archive (~131KB including header overhead). /// /// /// Typical usage: 500-1000 bytes for most archives