Open tritao opened 9 years ago
I was just thinking about this issue again and while this change fixed my original problem I'm not sure it's correct... we read the length as part of the extra
byte array so nothing actually guarantees that it needs to have a multiple-of-2 length. This could actually lead to not correctly loading the extra data for some archives.
Maybe it would be best to fix by checking that we have at least 2 more bytes before trying to convert the data with BitConverter
. What do you think?
Been so long since I've looked at this, trying to wrap my head around it again...
glancing at the spec again, it's supposed to be pairs of 2 byte headers for extended values. Ensuring that there are actually 2 bytes to read before trying to read them seems to make the most sense.
Just surprised by how many things write bad zip headers.
It has come to my attention that certain Android package archives (APKs) are not extractable by SharpCompress due to the following exception:
From a simple reading of some Zip specs it seems that extra data always should be in a multiple of 2 bytes so I did this simple fix which gets these archives to work: