InflaterInputStream doesn't reset position of underlying stream to end of deflated data
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 45/100
Direção de pesquisa
Comece em InflaterInputStream e em seu ponto de entrada Read; em seguida, reproduza o exemplo com um arquivo que contenha dados no final para observar como a posição do fluxo subjacente muda. Está concluído quando o fluxo subjacente estiver posicionado no final dos dados compactados após a descompactação, de modo que a leitura subsequente de 4 bytes retorne os dados finais, em vez de bytes armazenados em buffer.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Linguagem predominante
- C#
- Estrelas
- 3.9k
- Forks
- 1k
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de icsharpcode/SharpZipLib
-
*no response* bug
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 78/100
icsharpcode/SharpZipLib#905 · 1 comentário ·
-
bug bzip2
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 45/100
icsharpcode/SharpZipLib#904 ·
-
SetLevel in ZipFileAbertaenhancement zip
Dificuldade 2/5 1-2 dias Facilidade para iniciantes 55/100
icsharpcode/SharpZipLib#903 ·
-
*no response* bug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 32/100
icsharpcode/SharpZipLib#901 · 1 comentário ·
-
*no response* bug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
icsharpcode/SharpZipLib#894 · 1 comentário ·
Todas as issues de icsharpcode/SharpZipLib
Issues semelhantes
-
Format request: .wbpzAbertaenhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
KnifeLemon/Filee#294 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 66/100
gavin-wolfe/wolfden#104 ·
Mantenedores costumam responder em até 1 dia
-
[BUG] Still libmicrohttpd dependency is not removed properly from External-Dependency-Info.txt fileAbertatype/bug
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
area:framework
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 72/100
nunit/docs#1262 · 3 comentários ·
Mantenedores costumam responder em até 1 dia
-
[辞書] かんそうりつ->乾燥率Aberta辞書
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 62/100
Mantenedores costumam responder em até 1 dia