mirror of
https://github.com/revanced/smali.git
synced 2025-05-19 15:37:06 +02:00
Fix reading order for DexBackedExceptionHandler
This commit is contained in:
parent
9c60ef2a10
commit
005690e855
@ -36,9 +36,18 @@ import org.jf.dexlib2.immutable.ImmutableExceptionHandler;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class DexBackedExceptionHandler extends ImmutableExceptionHandler {
|
||||
public DexBackedExceptionHandler(@Nonnull DexReader reader) {
|
||||
private DexBackedExceptionHandler(String exceptionType, int handlerCodeOffset) {
|
||||
// TODO: verify dalvik doesn't accept an exception handler that points in the middle of an instruction
|
||||
super(reader.getType(reader.readSmallUleb128()), reader.readSmallUleb128());
|
||||
super(exceptionType, handlerCodeOffset);
|
||||
}
|
||||
|
||||
// static factory method, because we can't read from the reader in the correct order while calling super() in the
|
||||
// constructor. ugh.
|
||||
public static DexBackedExceptionHandler createNew(@Nonnull DexReader reader) {
|
||||
int typeId = reader.readSmallUleb128();
|
||||
String exceptionType = reader.getType(typeId);
|
||||
int handlerCodeOffset = reader.readSmallUleb128();
|
||||
return new DexBackedExceptionHandler(exceptionType, handlerCodeOffset);
|
||||
}
|
||||
|
||||
public static void skipFrom(@Nonnull DexReader reader) {
|
||||
|
@ -74,7 +74,7 @@ public class DexBackedTryBlock implements TryBlock {
|
||||
@Nonnull
|
||||
@Override
|
||||
protected ExceptionHandler readItem(@Nonnull DexReader reader, int index) {
|
||||
return new DexBackedExceptionHandler(reader);
|
||||
return DexBackedExceptionHandler.createNew(reader);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -94,7 +94,7 @@ public class DexBackedTryBlock implements TryBlock {
|
||||
if (index == sizeWithCatchAll-1) {
|
||||
return new DexBackedCatchAllExceptionHandler(dexReader);
|
||||
} else {
|
||||
return new DexBackedExceptionHandler(dexReader);
|
||||
return DexBackedExceptionHandler.createNew(dexReader);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user