From b00a80be9fa6f3c934e1dbc795083a249fd40a46 Mon Sep 17 00:00:00 2001 From: bauner Date: Sat, 20 Jan 2018 10:46:15 +0100 Subject: [PATCH] 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 https://git.replicant.us/replicant/frameworks_base/commit/?id=953d2a3493aaceb3209afc7eef1ff1e7f7242908 --- libs/androidfw/AssetManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp index e6e45633dc498..bc7e598eecd13 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;