From: Ben Gruver Date: Wed, 7 Mar 2012 03:26:22 +0000 (-0800) Subject: Fix up getAttributeFlags() function X-Git-Url: https://git.saurik.com/android/aapt.git/commitdiff_plain/fb9204d5c854f5149ee0da86b729b9d5d8c5b194 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 --- diff --git a/ResourceTable.cpp b/ResourceTable.cpp index 0c0b2ea..df6abe8 100644 --- a/ResourceTable.cpp +++ b/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;