summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Lesinski <adamlesinski@google.com>2014-04-08 12:01:38 -0700
committerXavier Ducrohet <xav@google.com>2014-05-05 12:01:21 -0700
commitf2d2c871813656012420faa89080d8e3cda1f308 (patch)
tree318d71ae17dfc7712309d153a86c45548584fb45
parentfd876194cf12352545048f77f626c839cc7ef787 (diff)
downloadframeworks_base-f2d2c871813656012420faa89080d8e3cda1f308.zip
frameworks_base-f2d2c871813656012420faa89080d8e3cda1f308.tar.gz
frameworks_base-f2d2c871813656012420faa89080d8e3cda1f308.tar.bz2
AAPT should not process XML that failed to compile
AAPT would attempt to warn if an unprefixed 'id' attribute was used in an XML resource file even if that XML file failed to compile. The result was undefined behaviour, including crashing the process. Change-Id: I1a9464ec937760e8d38bbe1af8d1b5d6b2c105a2
-rw-r--r--tools/aapt/Resource.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index 08ad7a0..822bfa5 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -1236,12 +1236,13 @@ status_t buildResources(Bundle* bundle, const sp<AaptAssets>& assets)
while ((err=it.next()) == NO_ERROR) {
String8 src = it.getFile()->getPrintableSource();
err = compileXmlFile(assets, it.getFile(), &table, xmlFlags);
- if (err != NO_ERROR) {
+ if (err == NO_ERROR) {
+ ResXMLTree block;
+ block.setTo(it.getFile()->getData(), it.getFile()->getSize(), true);
+ checkForIds(src, block);
+ } else {
hasErrors = true;
}
- ResXMLTree block;
- block.setTo(it.getFile()->getData(), it.getFile()->getSize(), true);
- checkForIds(src, block);
}
if (err < NO_ERROR) {