[BUG]Wrong Invalid register: v16 error
Information
- V2.6.2
- Mac ARM
- Zombie Tusnami -
Steps to Reproduce
- decompile app
- inject smali
- try to recompile
APK
apk the smali file is more useful complete code
hi, I am injecting a piece of code and subverting the program fellow to my own code through smali modification.
Original code
.locals 12
...
invoke-static {p2}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V
modified code
.locals 13
...
const-class v12, Lclass/code/main;
invoke-static {v12, p2}, Lcom/mypackage/myclass;->mymethod(Ljava/lang/Class;Ljava/lang/String;)V
the new register here 'v12' which is clearly lower than 16 and there is no registers with 16 or more in the file but got this error when I try to build it.
Invalid register: v16. Must be between v0 and v15, inclusive more oddly at places where I made no changes(in the same class file) I used this injection at many apps and they seem to work fine just going this is the only error I got by this sort
here is the gist file for complete code the modification is at line 95
I don't think Apktool is at fault here. If you added a local and shifted all items it would increase out of bounds of the registers.
i did not shift i just added one parameter, even If I add one parameter still it's 12 registers
See my response: https://github.com/JesusFreke/smali/issues/858#issuecomment-1287827280