Permalink
Browse files

Fix parsing of "version needed to extract" field

This field consists of two bytes, upper one indicating host OS and lower one
indicating version of Zip (de)compressor. Tomake sure if one can unpack given
archive it's only lower byte which is needed to be checked, but library used
to check both.
  • Loading branch information...
1 parent 3fa6c7b commit 3013f62f9654f74880eb25f1fa3d59b57ca2acce @Minoru Minoru committed Mar 19, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 Codec/Archive/Zip.hs
View
@@ -578,7 +578,8 @@ getFileHeader locals = do
else do
skip 4 -- skip past signature
skip 2 -- version made by
- versionNeededToExtract <- getWord16le
+ versionNeededToExtract <- getWord8
+ skip 1 -- upper byte indicates OS part of "version needed to extract"
unless (versionNeededToExtract <= 20) $
fail "This archive requires zip >= 2.0 to extract."
skip 2 -- general purpose bit flag

0 comments on commit 3013f62

Please sign in to comment.