summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-11-02 22:01:34 (GMT)
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-11-02 22:01:34 (GMT)
commit953d2a3493aaceb3209afc7eef1ff1e7f7242908 (patch)
treeed3507b23719e068e855a1eccf6129c1871b00de
parentbf8633348ba7ff5b191812b1bbb7e4edf94869a0 (diff)
downloadframeworks_base-953d2a3493aaceb3209afc7eef1ff1e7f7242908.zip
frameworks_base-953d2a3493aaceb3209afc7eef1ff1e7f7242908.tar.gz
frameworks_base-953d2a3493aaceb3209afc7eef1ff1e7f7242908.tar.bz2
Point ResXMLTree to a copy of the asset buffer in AssetManager::getPkgName()
This ensures that there is no dangling pointer when the asset is closed. Without this fix, a device ends up in a boot loop when an app is installed that was created using aapt2. Reference: https://github.com/TwidereProject/Twidere-Android/issues/963#issuecomment-335616312 Signed-off-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
-rw-r--r--libs/androidfw/AssetManager.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp
index e6e4563..f99154e 100644
--- a/libs/androidfw/AssetManager.cpp
+++ b/libs/androidfw/AssetManager.cpp
@@ -421,7 +421,7 @@ String8 AssetManager::getPkgName(const char *apkPath) {
Asset* manifestAsset = openNonAssetInPathLocked(kAndroidManifest, Asset::ACCESS_BUFFER, ap);
tree.setTo(manifestAsset->getBuffer(true),
- manifestAsset->getLength());
+ manifestAsset->getLength(), true);
tree.restart();
size_t len;