McNeight / tar-cs

Automatically exported from code.google.com/p/tar-cs
Other
0 stars 1 forks source link

TarReader.Read get caught in endlees loop if archive has less bytes than read from header #27

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Reading from a broken tar archive, the Read method in TarReader.cs keep looping 
endlesly...

The following couple of lines in  protected int Read(out byte[] buffer) makes 
sure I don't get stuck.

I have attached my version of TarReader.

if (inStream.Position == inStream.Length)
{
   buffer = null;
   throw new TarException("Inconsistency reading from tar, end of stream reached before all bytes consumed according to header");
}           }

Original issue reported on code.google.com by Christian.Gleerup@gmail.com on 17 Sep 2014 at 1:42

Attachments: