From 1d105aa5970659d47bef3ca6fc8a92a43c69c93b Mon Sep 17 00:00:00 2001 From: Adam Lesinski Date: Mon, 10 Apr 2017 12:08:22 -0700 Subject: [PATCH] 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 --- libziparchive/zip_archive.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc index 246575f81..a3896fc08 100644 --- a/libziparchive/zip_archive.cc +++ b/libziparchive/zip_archive.cc @@ -564,9 +564,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;