OSDN Git Service

Fix incorrect calculation of sizeof package structure
authorWan He <xiaolin.gxl@alibaba-inc.com>
Thu, 17 Nov 2016 09:49:37 +0000 (17:49 +0800)
committerWan He <xiaolin.gxl@alibaba-inc.com>
Thu, 17 Nov 2016 10:05:20 +0000 (18:05 +0800)
Argument "package" is a pointer, not the structure.

Signed-off-by: Wan He <xiaolin.gxl@alibaba-inc.com>
libs/androidfw/ResourceTypes.cpp

index fd30c25..e10db05 100644 (file)
@@ -3166,7 +3166,7 @@ struct ResTable::Package
 {
     Package(ResTable* _owner, const Header* _header, const ResTable_package* _package)
         : owner(_owner), header(_header), package(_package), typeIdOffset(0) {
-        if (dtohs(package->header.headerSize) == sizeof(package)) {
+        if (dtohs(package->header.headerSize) == sizeof(*package)) {
             // The package structure is the same size as the definition.
             // This means it contains the typeIdOffset field.
             typeIdOffset = package->typeIdOffset;