Open farfromrefug opened 3 months ago
Hi, could you try with a built version of main? If that doesn't solve it, we'll need more info to trace the issue within dexlib2
Hi, could you try with a built version of main? If that doesn't solve it, we'll need more info to trace the issue within dexlib2
@melcz @farfromrefug Hi, I fixed the issue, the exception happen due to opcode "invoke-custom"'s referenceType CALL_SITE, because inside DexWriter#writeCodeItem
function, code do not handle outParamCount for CALL_SITE referenceType, so when a method body only have invoke-custom inst (which usually happen when turn "record" keyword function into smali code), the final outs_size
of this function will be zero, then ART VM will throw out "exceeds outsSize" exception.
And BTW I add below code after referenceType check to fix this issue:
} else if (instruction.getOpcode().referenceType == ReferenceType.CALL_SITE) {
outParamCount = ((VariableRegisterInstruction)instruction).getRegisterCount();
}
@MG1937 Awesome! It is commited? I dont see it
@MG1937 Awesome! It is commited? I dont see it
No, I don't submit PR, I just change the code and rebuild it in local😂
@MG1937 Awesome! It is commited? I dont see it
No, I don't submit PR, I just change the code and rebuild it in local😂
OK i might try to create a PR. Can you point me to where i need to change the code. That i can try to build locally and see if it works.
@MG1937 Awesome! It is commited? I dont see it
No, I don't submit PR, I just change the code and rebuild it in local😂
OK i might try to create a PR. Can you point me to where i need to change the code. That i can try to build locally and see if it works.
you can search below code inside DexWriter#writeCodeItem function:
if (instruction.getOpcode().referenceType == ReferenceType.METHOD)
then add the patch code I mentioned before after this if
statement to fix this issue.
patch code:
} else if (instruction.getOpcode().referenceType == ReferenceType.CALL_SITE) {
outParamCount = ((VariableRegisterInstruction)instruction).getRegisterCount();
}
@MG1937 Awesome! It is commited? I dont see it
No, I don't submit PR, I just change the code and rebuild it in local😂
OK i might try to create a PR. Can you point me to where i need to change the code. That i can try to build locally and see if it works.
you can search below code inside DexWriter#writeCodeItem function:
if (instruction.getOpcode().referenceType == ReferenceType.METHOD)
then add the patch code I mentioned before after thisif
statement to fix this issue. patch code:} else if (instruction.getOpcode().referenceType == ReferenceType.CALL_SITE) { outParamCount = ((VariableRegisterInstruction)instruction).getRegisterCount(); }
Thanks a lot. I am testing right now! if it works i will create a PR.
@MG1937 it works! thank you so much. I created a PR referencing you @melcz can you look at the PR https://github.com/google/smali/pull/76 ? Thanks
I have a script which modifies a jar using APKTool which uses smali 3.0.7. With the recompiled jar ,I end up with errors like this:
It seems like the method
com.android.server.policy.SingleKeyGestureDetector$MessageObject.toString()
does not have the same signature in the rebuilt jar.