From 953d2a3493aaceb3209afc7eef1ff1e7f7242908 Mon Sep 17 00:00:00 2001 From: Wolfgang Wiedmeyer Date: Thu, 2 Nov 2017 23:01:34 +0100 Subject: 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 --- 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 e6e45633dc4..f99154ea6fd 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; -- cgit v1.2.3