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)
(cherry picked from commit 73b3aa541f1ad3fff961c9423dbaaf048452ca4b)
Change-Id: Ia672a28732154a564ea2f2e3520238bb77924a56
diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc
index 246575f..a3896fc 100644
--- a/libziparchive/zip_archive.cc
+++ b/libziparchive/zip_archive.cc
@@ -564,9 +564,9 @@
// 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;