mirror of
https://github.com/androguard/androguard.git
synced 2024-11-23 05:00:11 +00:00
Update __init__.py
fix 4-byte aligned padding
This commit is contained in:
parent
913c2cd907
commit
025aaa243c
@ -376,7 +376,8 @@ def determineNext(i, cur_idx, m):
|
||||
# "the instructions must be located on even-numbered bytecode offsets (that is, 4-byte aligned).
|
||||
# In order to meet this requirement, dex generation tools must
|
||||
# emit an extra nop instruction as a spacer if such an instruction would otherwise be unaligned."
|
||||
padding = (off + cur_idx) % 4
|
||||
remaining = (off + cur_idx) % 4
|
||||
padding = 0 if remaining == 0 else (4 - remaining)
|
||||
if padding != 0:
|
||||
logger.warning("Switch payload not aligned, assume stuff and add {} bytes...".format(padding))
|
||||
data = code.get_ins_off(off + cur_idx + padding)
|
||||
|
Loading…
Reference in New Issue
Block a user