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

Commit 666b6fbb authored by Adam Lesinski's avatar Adam Lesinski
Browse files

Fix order of operation issue with ResStringPool

Due to ! taking precedence over bitwise &, the condition for
checking non-null terminated string blocks is incorrect.

Adds parentheses for the correct behavior.

Bug:28288210
Change-Id: Ie31fa239e5f869e6bb28deb6ae190f41f1aa4d92
parent 3053c3f2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -562,7 +562,7 @@ status_t ResStringPool::setTo(const void* data, size_t size, bool copyData)

        if ((mHeader->flags&ResStringPool_header::UTF8_FLAG &&
                ((uint8_t*)mStrings)[mStringPoolSize-1] != 0) ||
                (!mHeader->flags&ResStringPool_header::UTF8_FLAG &&
                (!(mHeader->flags&ResStringPool_header::UTF8_FLAG) &&
                ((uint16_t*)mStrings)[mStringPoolSize-1] != 0)) {
            ALOGW("Bad string block: last string is not 0-terminated\n");
            return (mError=BAD_TYPE);