eagleflo / mpyq

Python library for reading MPQ archives.
BSD 2-Clause "Simplified" License
99 stars 23 forks source link

Compare with bytes left when checking compression. #26

Closed GraylinKim closed 10 years ago

GraylinKim commented 10 years ago

The last sector of a file may be uncompressed if the sector length is less than or equal to the the number of bytes remaining. I've added an s2ma file to the test folder that demonstrates this issue.

See: https://github.com/stormlib/StormLib/blob/master/src/SFileReadFile.cpp#L109

Their logic is a little convoluted, but they cut down the expected sector size if the last sector isn't big enough. This causes the compression check down on L159 to fail.

eagleflo commented 10 years ago

Nice catch! Thanks for your contribution, just released v0.2.4 with this fix.