tobiasschulz / tar-cs

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

Problems with extraction at TarHeader.UpdateHeaderFromBytes, missing Trim() ?!?. #26

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In the function
TarHeader.UpdateHeaderFromBytes()
are some converts to int calls. 

Some buffer reads are with ".Trim()" some don't.

I have a tar file that crashed the determination of SizeInBytes:
if((buffer[124] & 0x80) == 0x80) // if size in binary
{
  long sizeBigEndian = BitConverter.ToInt64(buffer,0x80);
  SizeInBytes = IPAddress.NetworkToHostOrder(sizeBigEndian);
}
else
{
  SizeInBytes = Convert.ToInt64(Encoding.ASCII.GetString(buffer, 124, 11), 8);
}

In the call of Convert.ToInt64 in the else section. I've added the ".trim" 
after the GetString-Method and it works. The result of extrat is similar the 
the extracting with 7zip.

Original issue reported on code.google.com by yout...@csp-shop.de on 28 Aug 2014 at 9:57

GoogleCodeExporter commented 9 years ago
I do confirm this.

Original comment by lucian.n...@gmail.com on 11 May 2015 at 8:53