InflaterInputStream doesn't reset position of underlying stream to end of deflated data
まだ誰も着手していません。
評価
調査の方向性
InflaterInputStream とその Read エントリポイントから始め、末尾データを含むファイルで例を再現して、基盤となるストリームの位置がどのように変化するかを確認します。インフレーション後に基盤となるストリームが圧縮データの末尾に位置し、その後の 4 バイトの読み取りでバッファリングされたバイトではなく末尾データが返されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Steps to reproduce
- Obtain a file that contains a deflated blob with some other data following it. In my case, I have a binary file where there is a deflated blob, followed by some additional ints/floats/etc. It's important that there is trailing data after the deflated blob. It doesn't matter what the data is, it could be garbage. It just has to exist. The code below assumes there is at least 4 bytes in this trailing data.
- Run this simple program against it, after filling in appropriate values for InFile, InFileCompressedDataStartPos, InFileCompressedLength, and InFileUncompressedLength:
internal class Program
{
private static string InFile = @"";
private static int InFileCompressedDataStart = 0;
private static int InFileCompressedLength = 0;
private static int InFileUncompressedLength = 0;
public static void Main(string[] args)
{
using (var stream = File.OpenRead(InFile))
{
stream.Position = InFileCompressedDataStart;
//Encounter deflated blob in stream, and inflate it
using (var zStream = new InflaterInputStream(stream))
{
zStream.IsStreamOwner = false;
var buffer = new byte[InFileUncompressedLength];
var streamStartPos = stream.Position;
Console.WriteLine($"Stream position before inflate: {streamStartPos}");
var read = zStream.Read(buffer, 0, InFileCompressedLength);
Console.WriteLine($"InflaterInputStream read {read} bytes");
var streamEndPos = stream.Position;
Console.WriteLine($"Stream position after inflate: {streamEndPos}");
Console.WriteLine($"Stream position moved {streamEndPos - streamStartPos} bytes during read");
}
//Continue on with data following deflated blob
var testBuffer = new byte[4];
stream.Read(testBuffer, 0, 4); //This reads from the wrong offset in the file!
}
}
}
- Note the console output
Expected behavior
stream.Position should have progressed by InFileCompressedLength. (to allow the trailing data to be read independently)
Actual behavior
stream.Position progressed by some amount greater than InFileCompressedLength. (this is part way thru completely unrelated data!)
Version of SharpZipLib
1.3.1
Obtained from (only keep the relevant lines)
- Package installed using NuGet
- 主要言語
- C#
- スター
- 3.9k
- フォーク
- 1k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
icsharpcode/SharpZipLib のほかの issue
-
*no response* bug
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
icsharpcode/SharpZipLib#905 · コメント 1 件 ·
-
bug bzip2
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
icsharpcode/SharpZipLib#904 ·
-
SetLevel in ZipFileオープンenhancement zip
難易度 2/5 1〜2日 初心者へのやさしさ 55/100
icsharpcode/SharpZipLib#903 ·
-
*no response* bug
難易度 4/5 3〜5日 初心者へのやさしさ 32/100
icsharpcode/SharpZipLib#901 · コメント 1 件 ·
-
*no response* bug
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
icsharpcode/SharpZipLib#894 · コメント 1 件 ·
icsharpcode/SharpZipLib の issue をすべて見る
似ている issue
-
ci-failure-cause test-failure
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
area:frontend bug FE hotspot:css mvp P3
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
klasolsson81/jobbliggaren#1856 ·
メンテナーはふだん 1 日以内に返信
-
Area: App+Library Build
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Aaronontheweb/freshdesk-cli#148 ·