Skip to content

Commit

Permalink
Point ResXMLTree to a copy of the asset buffer in AssetManager::getPk…
Browse files Browse the repository at this point in the history
…gName()

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:
TwidereProject/Twidere-Android#963 (comment)
Signed-off-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>

https://git.replicant.us/replicant/frameworks_base/commit/?id=953d2a3493aaceb3209afc7eef1ff1e7f7242908
  • Loading branch information
bauner committed Feb 20, 2018
1 parent de32fc7 commit b00a80b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/androidfw/AssetManager.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit b00a80b

Please sign in to comment.