Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent poisioning mResTable if Framework is sparse. #3299

Merged
merged 1 commit into from
Aug 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,9 @@ private ResType readTableType() throws IOException, AndrolibException {

mHeader.checkForUnreadHeader(mIn);

if ((typeFlags & 0x01) != 0) {
// Be sure we don't poison mResTable by marking the application as sparse
// Only flag the ResTable as sparse if the main package is not loaded.
if ((typeFlags & 0x01) != 0 && !mResTable.isMainPkgLoaded()) {
mResTable.setSparseResources(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public void decodeWithExpectationOfSparseResources() throws BrutException, IOExc

LOGGER.info("Decoding sparse.apk...");
Config config = Config.getDefaultConfig();
config.frameworkTag = "issue-3298";

ApkDecoder apkDecoder = new ApkDecoder(config, testApk);
ApkInfo apkInfo = apkDecoder.decode(sTestNewDir);
Expand All @@ -70,6 +71,7 @@ public void decodeWithExpectationOfNoSparseResources() throws BrutException, IOE

LOGGER.info("Decoding not-sparse.apk...");
Config config = Config.getDefaultConfig();
config.frameworkTag = "issue-3298";

ApkDecoder apkDecoder = new ApkDecoder(config, testApk);
ApkInfo apkInfo = apkDecoder.decode(sTestNewDir);
Expand Down