libziparchive: verify that gpb flags match

The Central File Header and Local File Header should
have the same general purpose bit flags set for
consistency.

Bug: 36686974
Test: existing tests pass (ziparchive-tests)
Change-Id: I4602336fa96359219b8a3fd69fd318eed680c43d
This commit is contained in:
Adam Lesinski 2017-04-10 12:08:22 -07:00
parent e0eca55fe6
commit 73b3aa541f
1 changed files with 3 additions and 3 deletions

View File

@ -574,9 +574,9 @@ static int32_t FindEntry(const ZipArchive* archive, const int ent,
// Paranoia: Match the values specified in the local file header
// to those specified in the central directory.
// Verify that the central directory and local file header agree on the use of a trailing
// Data Descriptor.
if ((lfh->gpb_flags & kGPBDDFlagMask) != (cdr->gpb_flags & kGPBDDFlagMask)) {
// Verify that the central directory and local file header have the same general purpose bit
// flags set.
if (lfh->gpb_flags != cdr->gpb_flags) {
ALOGW("Zip: gpb flag mismatch. expected {%04" PRIx16 "}, was {%04" PRIx16 "}",
cdr->gpb_flags, lfh->gpb_flags);
return kInconsistentInformation;