diff options
author | Adam Lesinski <adamlesinski@google.com> | 2014-08-14 17:58:37 -0700 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2014-08-15 06:39:01 +0000 |
commit | 4b2d0f20db2e0f9395a0c12ed5d4b6020eb272cb (patch) | |
tree | c3f363ba74a9f6ce48ca3318b8672dea2a43ff0d /libs/androidfw | |
parent | 82d6d337b389ef088879a5e527d44c75c41c5b44 (diff) | |
download | frameworks_base-4b2d0f20db2e0f9395a0c12ed5d4b6020eb272cb.zip frameworks_base-4b2d0f20db2e0f9395a0c12ed5d4b6020eb272cb.tar.gz frameworks_base-4b2d0f20db2e0f9395a0c12ed5d4b6020eb272cb.tar.bz2 |
Fix crash in ResStringPool
When a String isn't found in the StringPool,
we should not try to construct a String8 object
from the NULL string.
Bug:15163956
Change-Id: I51e701918b10a72c18a860b8a36dce2afd9c0b82
Diffstat (limited to 'libs/androidfw')
-rw-r--r-- | libs/androidfw/ResourceTypes.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/libs/androidfw/ResourceTypes.cpp b/libs/androidfw/ResourceTypes.cpp index 702f150..1316cb8 100644 --- a/libs/androidfw/ResourceTypes.cpp +++ b/libs/androidfw/ResourceTypes.cpp @@ -802,11 +802,16 @@ const char* ResStringPool::string8At(size_t idx, size_t* outLen) const const String8 ResStringPool::string8ObjectAt(size_t idx) const { size_t len; - const char *str = (const char*)string8At(idx, &len); + const char *str = string8At(idx, &len); if (str != NULL) { - return String8(str); + return String8(str, len); } - return String8(stringAt(idx, &len)); + + const char16_t *str16 = stringAt(idx, &len); + if (str16 != NULL) { + return String8(str16, len); + } + return String8(); } const ResStringPool_span* ResStringPool::styleAt(const ResStringPool_ref& ref) const |