From 0dfe5352d96bdf3e66961df2fd43117b9030bacd Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Fri, 21 Aug 2009 15:23:45 -0500 Subject: [PATCH] Fix bitmask in aapt's StringPool length construction The StringPool indicates the length of a string with a 16-bit integer. If the length of the string is greater than 0x7FFF, it splits it into two 16-bit integers with the first one having the high bit set. The length calculation has a small bug that masks off the 19 bits instead of the first 15 bits as intended. --- StringPool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/StringPool.cpp b/StringPool.cpp index 878d3b1..715170a 100644 --- a/StringPool.cpp +++ b/StringPool.cpp @@ -228,7 +228,7 @@ status_t StringPool::writeStringBlock(const sp& pool) } dat += (preSize+strPos)/sizeof(uint16_t); if (lenSize > sizeof(uint16_t)) { - *dat = htods(0x8000 | ((strSize>>16)&0x7ffff)); + *dat = htods(0x8000 | ((strSize>>16)&0x7fff)); dat++; } *dat++ = htods(strSize); -- 2.47.2