From da44fe0e1f7c177cd65b7c5c80b35ec8fb3bc1c2 Mon Sep 17 00:00:00 2001 From: Jörgen Ekström Date: Thu, 24 Mar 2011 15:09:42 +0100 Subject: Fixing NULL pointer access causing segmentation fault in aapt In cases where resource packages are generated which does not have public resources for all resource types - NULL pointers sneaks into the mOrderedConfigs vector causing the aapt tool to crash. The solution in this fix simply ignores the NULL elements when later processing the sorted vector. The NULL elements are inserted during applyPublicEntryOrder function call Change-Id: I8b7135932e2d235018da2e2f7e09f0d22f1b2f59 --- tools/aapt/ResourceTable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/aapt/ResourceTable.cpp') diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp index 4cca57fdecb1..0ec1aebb8b40 100644 --- a/tools/aapt/ResourceTable.cpp +++ b/tools/aapt/ResourceTable.cpp @@ -3009,7 +3009,7 @@ status_t ResourceTable::flatten(Bundle* bundle, const sp& // We need to write one type chunk for each configuration for // which we have entries in this type. - const size_t NC = t->getUniqueConfigs().size(); + const size_t NC = t != NULL ? t->getUniqueConfigs().size() : 0; const size_t typeSize = sizeof(ResTable_type) + sizeof(uint32_t)*N; -- cgit v1.2.3-59-g8ed1b