InflaterInputStream doesn't reset position of underlying stream to end of deflated data
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 45/100
Piste de recherche
Commencez par InflaterInputStream et son point d’entrée Read, puis reproduisez l’exemple avec un fichier contenant des données finales afin d’observer comment la position du flux sous-jacent évolue. C’est terminé lorsque le flux sous-jacent se trouve à la fin des données compressées après la décompression, de sorte que la lecture suivante de 4 octets renvoie les données finales plutôt que des octets mis en mémoire tampon.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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
- Langage dominant
- C#
- Étoiles
- 3.9k
- Forks
- 1k
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de icsharpcode/SharpZipLib
-
*no response* bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 78/100
icsharpcode/SharpZipLib#905 · 1 commentaire ·
-
bug bzip2
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
icsharpcode/SharpZipLib#904 ·
-
SetLevel in ZipFileOuverteenhancement zip
Difficulté 2/5 1-2 jours Accessibilité débutants 55/100
icsharpcode/SharpZipLib#903 ·
-
*no response* bug
Difficulté 4/5 3-5 jours Accessibilité débutants 32/100
icsharpcode/SharpZipLib#901 · 1 commentaire ·
-
*no response* bug
Difficulté 4/5 3-5 jours Accessibilité débutants 35/100
icsharpcode/SharpZipLib#894 · 1 commentaire ·
Toutes les issues de icsharpcode/SharpZipLib
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
microsoft/onnxruntime-genai#2633 ·
Les mainteneurs répondent en général sous 1 jour
-
python triage
Difficulté 2/5 1-3 heures Accessibilité débutants 85/100
microsoft/semantic-kernel#14491 ·
Les mainteneurs répondent en général sous 2 jours
-
area:jobads-cv FE mvp P3
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
klasolsson81/jobbliggaren#1878 ·
Les mainteneurs répondent en général sous 1 jour
-
bug help wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
pnp/pnpcore#1878 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
SubtitleEdit/subtitleedit#15331 · 2 commentaires ·
Les mainteneurs répondent en général sous 1 jour