Skip to content

Commit 0d4443a

Browse files
committed
Gracefully deal with code addresses that are out of range in MutableMethodImplementation
The code addresses in debug info items are not verified, and may be out of bounds. If this happens, we just clamp them to the maximum code address.
1 parent 580b27f commit 0d4443a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

dexlib2/src/main/java/org/jf/dexlib2/builder/MutableMethodImplementation.java

+3
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,9 @@ private void fixInstructions() {
473473
private int mapCodeAddressToIndex(@Nonnull int[] codeAddressToIndex, int codeAddress) {
474474
int index;
475475
do {
476+
if (codeAddress >= codeAddressToIndex.length) {
477+
codeAddress = codeAddressToIndex.length - 1;
478+
}
476479
index = codeAddressToIndex[codeAddress];
477480
if (index < 0) {
478481
codeAddress--;

0 commit comments

Comments
 (0)