summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2014-05-21 21:59:33 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-05-21 21:59:33 +0000
commite34b8abf3adedda74a075be71f382ef716d64227 (patch)
treea53f40ff2291a44ef28563bcdb3bd68bc4a57038 /tools
parentf34771187b195706a9394f2066f9cf0f087ea2b5 (diff)
parent25e9d55e964c180ec6e57ba1d977d6c2e1115f5a (diff)
downloadframeworks_base-e34b8abf3adedda74a075be71f382ef716d64227.zip
frameworks_base-e34b8abf3adedda74a075be71f382ef716d64227.tar.gz
frameworks_base-e34b8abf3adedda74a075be71f382ef716d64227.tar.bz2
Merge "Don't dump data from a bad ResTable"
Diffstat (limited to 'tools')
-rw-r--r--tools/aapt/Command.cpp3
-rw-r--r--tools/aapt/StringPool.cpp8
2 files changed, 11 insertions, 0 deletions
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp
index 4e0a9fe..cc0da15 100644
--- a/tools/aapt/Command.cpp
+++ b/tools/aapt/Command.cpp
@@ -634,6 +634,9 @@ int doDump(Bundle* bundle)
if (&res == NULL) {
fprintf(stderr, "ERROR: dump failed because no resource table was found\n");
goto bail;
+ } else if (res.getError() != NO_ERROR) {
+ fprintf(stderr, "ERROR: dump failed because the resource table is invalid/corrupt.\n");
+ goto bail;
}
if (strcmp("resources", option) == 0) {
diff --git a/tools/aapt/StringPool.cpp b/tools/aapt/StringPool.cpp
index 158b391..06769e4 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++) {