summaryrefslogtreecommitdiff
path: root/tools/aapt/StringPool.cpp
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2014-05-19 15:01:43 -0700
committerAdam Lesinski <adamlesinski@google.com>2014-05-19 15:01:43 -0700
commit25e9d55e964c180ec6e57ba1d977d6c2e1115f5a (patch)
treebc25629c89459c5b2775f723174a9c5da69a0eb2 /tools/aapt/StringPool.cpp
parent605a07be7bdda0fd0f8aa4ff18e1769e298663e0 (diff)
Don't dump data from a bad ResTable
AAPT dumps data from a bad ResTable, which causes crashes. Prevent this by checking if there were errors when creating the ResTable. Bug:14902008 Change-Id: I5e04ebf967c60b78c511dd175785a13bca52f09a
Diffstat (limited to 'tools/aapt/StringPool.cpp')
-rw-r--r--tools/aapt/StringPool.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/aapt/StringPool.cpp b/tools/aapt/StringPool.cpp
index 158b39196cb3..06769e4a6b4d 100644
--- a/tools/aapt/StringPool.cpp
+++ b/tools/aapt/StringPool.cpp
@@ -33,6 +33,14 @@ void strcpy16_htod(uint16_t* dst, const uint16_t* src)
void printStringPool(const ResStringPool* pool)
{
+ if (pool->getError() == NO_INIT) {
+ printf("String pool is unitialized.\n");
+ return;
+ } else if (pool->getError() != NO_ERROR) {
+ printf("String pool is corrupt/invalid.\n");
+ return;
+ }
+
SortedVector<const void*> uniqueStrings;
const size_t N = pool->size();
for (size_t i=0; i<N; i++) {