DO NOT MERGE : Fix build breakage due to 2d516d2d46b1b1.
Test: make
Test: zip_archive_test
Bug: 64211847
(cherry picked from commit 547c7d9a0b6651ace0ade7849661ba6c20770ae6)
(cherry picked from commit bfe4b5edb3097df66ddbf9639c3b3cd290734ed8)
Change-Id: Ide48ce66542e152d88520dcd6abcd104e48137f6
diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc
index d0ba3d4..7cc9ac3 100644
--- a/libziparchive/zip_archive.cc
+++ b/libziparchive/zip_archive.cc
@@ -594,6 +594,8 @@
return result;
}
+static inline ssize_t ReadAtOffset(int fd, uint8_t* buf, size_t len, off64_t off);
+
/*
* Parses the Zip archive's Central Directory. Allocates and populates the
* hash table.
@@ -672,8 +674,8 @@
}
uint32_t lfh_start_bytes;
- if (!archive->mapped_zip.ReadAtOffset(reinterpret_cast<uint8_t*>(&lfh_start_bytes),
- sizeof(uint32_t), 0)) {
+ if (ReadAtOffset(archive->fd, reinterpret_cast<uint8_t*>(&lfh_start_bytes),
+ sizeof(uint32_t), 0) != sizeof(uint32_t)) {
ALOGW("Zip: Unable to read header for entry at offset == 0.");
return -1;
}