Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 59eb5fd5 authored by Ben Gruver's avatar Ben Gruver
Browse files

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
parent 5eb37241
Loading
Loading
Loading
Loading
+2 −6
Original line number Original line Diff line number Diff line
@@ -2304,10 +2304,8 @@ bool ResourceTable::getAttributeFlags(


        const char16_t* end = name + nameLen;
        const char16_t* end = name + nameLen;
        const char16_t* pos = name;
        const char16_t* pos = name;
        bool failed = false;
        while (pos < end) {
        while (pos < end && !failed) {
            const char16_t* start = pos;
            const char16_t* start = pos;
            end++;
            while (pos < end && *pos != '|') {
            while (pos < end && *pos != '|') {
                pos++;
                pos++;
            }
            }
@@ -2333,10 +2331,8 @@ bool ResourceTable::getAttributeFlags(
                // Didn't find this flag identifier.
                // Didn't find this flag identifier.
                return false;
                return false;
            }
            }
            if (pos < end) {
            pos++;
            pos++;
        }
        }
        }


        return true;
        return true;
    }
    }