summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Gruver <bgruv@google.com>2012-03-06 19:26:22 -0800
committerBen Gruver <bgruv@google.com>2012-03-07 10:49:55 -0800
commit59eb5fd509c98a371b8824f6b13cf29981a4f063 (patch)
treec40de115ed24179aa4dbabd93f8634f8167d8efc
parent5eb37241fee7e656cf9787bf00a160e94b4894fc (diff)
downloadframeworks_base-59eb5fd509c98a371b8824f6b13cf29981a4f063.zip
frameworks_base-59eb5fd509c98a371b8824f6b13cf29981a4f063.tar.gz
frameworks_base-59eb5fd509c98a371b8824f6b13cf29981a4f063.tar.bz2
Fix up getAttributeFlags() function
In addition to a couple of minor clean-up items, this fixes an issue that can rarely cause incorrect parsing of attribute flag values, when there is a '|' character in the few bytes past the end of the attribute value being parsed. Change-Id: I6050b1c2db60720c7c0ab7df9eba8cfc629b320e
-rw-r--r--tools/aapt/ResourceTable.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index 0c0b2ea..df6abe8 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -2304,10 +2304,8 @@ bool ResourceTable::getAttributeFlags(
const char16_t* end = name + nameLen;
const char16_t* pos = name;
- bool failed = false;
- while (pos < end && !failed) {
+ while (pos < end) {
const char16_t* start = pos;
- end++;
while (pos < end && *pos != '|') {
pos++;
}
@@ -2333,9 +2331,7 @@ bool ResourceTable::getAttributeFlags(
// Didn't find this flag identifier.
return false;
}
- if (pos < end) {
- pos++;
- }
+ pos++;
}
return true;