mirror of
https://github.com/revanced/revanced-patcher.git
synced 2025-05-01 21:54:24 +02:00
feat: Allow unknown opcodes using null
This is the same as `??` in IDA signatures.
This commit is contained in:
parent
6ca05769ef
commit
0e5f4ba2d5
@ -10,13 +10,14 @@ import org.jf.dexlib2.Opcode
|
|||||||
* @param accessFlags The access flags of the method.
|
* @param accessFlags The access flags of the method.
|
||||||
* @param methodParameters The parameters of the method.
|
* @param methodParameters The parameters of the method.
|
||||||
* @param opcodes The list of opcodes of the method.
|
* @param opcodes The list of opcodes of the method.
|
||||||
|
* A `null` opcode is equals to an unknown opcode.
|
||||||
*/
|
*/
|
||||||
class MethodSignature(
|
class MethodSignature(
|
||||||
val metadata: MethodSignatureMetadata,
|
val metadata: MethodSignatureMetadata,
|
||||||
internal val returnType: String?,
|
internal val returnType: String?,
|
||||||
internal val accessFlags: Int?,
|
internal val accessFlags: Int?,
|
||||||
internal val methodParameters: Iterable<String>?,
|
internal val methodParameters: Iterable<String>?,
|
||||||
internal val opcodes: Iterable<Opcode>?
|
internal val opcodes: Iterable<Opcode?>?
|
||||||
) {
|
) {
|
||||||
/**
|
/**
|
||||||
* The result of the signature
|
* The result of the signature
|
||||||
|
@ -93,7 +93,11 @@ internal class SignatureResolver(
|
|||||||
while (instructionIndex + patternIndex < count) {
|
while (instructionIndex + patternIndex < count) {
|
||||||
val originalOpcode = instructions.elementAt(instructionIndex + patternIndex).opcode
|
val originalOpcode = instructions.elementAt(instructionIndex + patternIndex).opcode
|
||||||
val patternOpcode = pattern.elementAt(patternIndex)
|
val patternOpcode = pattern.elementAt(patternIndex)
|
||||||
if (originalOpcode != patternOpcode && currentThreshold-- == 0) break
|
if (
|
||||||
|
patternOpcode != null && // unknown opcode
|
||||||
|
originalOpcode != patternOpcode &&
|
||||||
|
currentThreshold-- == 0
|
||||||
|
) break
|
||||||
if (++patternIndex < size) continue
|
if (++patternIndex < size) continue
|
||||||
|
|
||||||
val result = PatternScanResult(instructionIndex, instructionIndex + patternIndex)
|
val result = PatternScanResult(instructionIndex, instructionIndex + patternIndex)
|
||||||
@ -125,7 +129,10 @@ internal class SignatureResolver(
|
|||||||
for ((patternIndex, originalIndex) in (scanResult.startIndex until scanResult.endIndex).withIndex()) {
|
for ((patternIndex, originalIndex) in (scanResult.startIndex until scanResult.endIndex).withIndex()) {
|
||||||
val originalOpcode = instructions.elementAt(originalIndex).opcode
|
val originalOpcode = instructions.elementAt(originalIndex).opcode
|
||||||
val patternOpcode = pattern.elementAt(patternIndex)
|
val patternOpcode = pattern.elementAt(patternIndex)
|
||||||
if (originalOpcode != patternOpcode) {
|
if (
|
||||||
|
patternOpcode != null && // unknown opcode
|
||||||
|
originalOpcode != patternOpcode
|
||||||
|
) {
|
||||||
this.add(
|
this.add(
|
||||||
PatternScanMethod.Fuzzy.Warning(
|
PatternScanMethod.Fuzzy.Warning(
|
||||||
originalOpcode, patternOpcode,
|
originalOpcode, patternOpcode,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user