If a Zip entry has the "length at end" flag set, then just ignore

a length field of zero; it does not mean the body is empty.

Thanks to: Lapo Luchini for sending me a JAR archive that demonstrated this bug
MFC after: 3 days
This commit is contained in:
kientzle 2007-12-04 06:32:12 +00:00
parent 61e8cfdeeb
commit 8327024837

View File

@ -336,7 +336,8 @@ zip_read_file_header(struct archive_read *a, struct archive_entry *entry,
zip->entry_offset = 0;
/* If there's no body, force read_data() to return EOF immediately. */
if (zip->entry_bytes_remaining < 1)
if (0 == (zip->flags & ZIP_LENGTH_AT_END)
&& zip->entry_bytes_remaining < 1)
zip->end_of_entry = 1;
/* Set up a more descriptive format name. */