diff options
author | Narayan Kamath <narayan@google.com> | 2015-06-16 12:02:57 +0100 |
---|---|---|
committer | Narayan Kamath <narayan@google.com> | 2015-06-17 13:13:16 +0000 |
commit | 407753c456c1eb2c8556ae7891b6bef43b044e76 (patch) | |
tree | 8dcc64a1dd532071a5a626821bc4d54abd6a3b4d /libs/androidfw/ZipFileRO.cpp | |
parent | dc22cfed5d3a65dcd3979113dbce468ad8ec2868 (diff) |
ZipFileRO: Use precise widths for zip file types.
getEntryInfo crashes on 64-bit devices because "long" types
were being passed int pointers (that pointed to a stack frame)
that were reinterpret_cast'ed to long* (sigh.). To fix this issue
once and for all, use types with explicitly defined widths.
This change also removes some dead invariant checking from
Asset.cpp instead of cleaning it up.
Note that we've introduced a wart in NativeLibraryHelper, where
we need to deal with zlib's uLong type, which is "at least 32 bits
wide".
bug: 21622286
(cherry picked from commit 4600dd053dbdbd4b95f3b11057a1cc55b99f9c77)
Change-Id: I7886cb37a229cc27c625699c80e6a6a6117d2203
Diffstat (limited to 'libs/androidfw/ZipFileRO.cpp')
-rw-r--r-- | libs/androidfw/ZipFileRO.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libs/androidfw/ZipFileRO.cpp b/libs/androidfw/ZipFileRO.cpp index af3d9b3bd716..b61d17926dc3 100644 --- a/libs/androidfw/ZipFileRO.cpp +++ b/libs/androidfw/ZipFileRO.cpp @@ -96,8 +96,9 @@ ZipEntryRO ZipFileRO::findEntryByName(const char* entryName) const * Returns "false" if the offsets to the fields or the contents of the fields * appear to be bogus. */ -bool ZipFileRO::getEntryInfo(ZipEntryRO entry, int* pMethod, size_t* pUncompLen, - size_t* pCompLen, off64_t* pOffset, long* pModWhen, long* pCrc32) const +bool ZipFileRO::getEntryInfo(ZipEntryRO entry, uint16_t* pMethod, + uint32_t* pUncompLen, uint32_t* pCompLen, off64_t* pOffset, + uint32_t* pModWhen, uint32_t* pCrc32) const { const _ZipEntryRO* zipEntry = reinterpret_cast<_ZipEntryRO*>(entry); const ZipEntry& ze = zipEntry->entry; @@ -165,7 +166,7 @@ void ZipFileRO::releaseEntry(ZipEntryRO entry) const /* * Copy the entry's filename to the buffer. */ -int ZipFileRO::getEntryFileName(ZipEntryRO entry, char* buffer, int bufLen) +int ZipFileRO::getEntryFileName(ZipEntryRO entry, char* buffer, size_t bufLen) const { const _ZipEntryRO* zipEntry = reinterpret_cast<_ZipEntryRO*>(entry); |