Skip to content

生成补丁包时出现 ArrayIndexOutOfBoundsException #1771

@TestPlanB

Description

@TestPlanB

框架版本

1.9.15.1 都有问题

复现场景:
AGP 7.4 && isProtectedApp = true 情况下

问题堆栈

Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 7 out of bounds for length 7 at org.jf.dexlib2.builder.BuilderMutableMethodImplementation.mapCodeAddressToIndex(BuilderMutableMethodImplementation.java:586) at org.jf.dexlib2.builder.BuilderMutableMethodImplementation.<init>(BuilderMutableMethodImplementation.java:201) at com.tencent.tinker.build.decoder.DexDiffDecoder.generateChangedClassesDexFile(DexDiffDecoder.java:470) at com.tencent.tinker.build.decoder.DexDiffDecoder.onAllPatchesEnd(DexDiffDecoder.java:249) at com.tencent.tinker.build.decoder.ApkDecoder.patch(ApkDecoder.java:128) at com.tencent.tinker.build.patch.Runner.tinkerPatch(Runner.java:69)

问题源码

isProtectedApp 为true后,会走到创建 BuilderMutableMethodImplementation 流程,这个对象初始化时调用的mapCodeAddressToIndex方法,出现codeAddress数组越界

private int mapCodeAddressToIndex(@Nonnull int[] codeAddressToIndex, int codeAddress) { int index; do { index = codeAddressToIndex[codeAddress]; if (index < 0) { codeAddress--; } else { return index; } } while (true); }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions