Permalink
Browse files

Fix wordlength bug in ResTable::parsePackage

The package header field "size" is 32 bits, not 16.  Therefore,
the function dtohl(), not dtohs(), needs to be used to convert
it to host byteorder.

Change-Id: Id276aec8c5d791d2fc4e460b2c2094e55ca33c1c
  • Loading branch information...
1 parent 2b82d29 commit 10ac519f174498b77a9ae93f1938947f128e850d @zeldin zeldin committed with peshovec Sep 26, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 libs/utils/ResourceTypes.cpp
@@ -3901,7 +3901,7 @@ status_t ResTable::parsePackage(const ResTable_package* const pkg,
const ResChunk_header* chunk =
(const ResChunk_header*)(((const uint8_t*)pkg)
+ dtohs(pkg->header.headerSize));
- const uint8_t* endPos = ((const uint8_t*)pkg) + dtohs(pkg->header.size);
+ const uint8_t* endPos = ((const uint8_t*)pkg) + dtohl(pkg->header.size);
while (((const uint8_t*)chunk) <= (endPos-sizeof(ResChunk_header)) &&
((const uint8_t*)chunk) <= (endPos-dtohl(chunk->size))) {
TABLE_NOISY(LOGV("PackageChunk: type=0x%x, headerSize=0x%x, size=0x%x, pos=%p\n",

0 comments on commit 10ac519

Please sign in to comment.