Skip to content

Commit

Permalink
fix: only mark as sparse if intended application (#3299)
Browse files Browse the repository at this point in the history
  • Loading branch information
iBotPeaches committed Aug 27, 2023
1 parent 06c5f46 commit 81a7e1e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
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

0 comments on commit 81a7e1e

Please sign in to comment.