Skip to content

PyEval._invoke silently skips IndexError in certain pipeline #867

@dolamroth

Description

@dolamroth

This line in certain situations throws IndexError, which is silenced elsewhere (because analysis does not fail overall):

valueOfRegList[argIdx].value_type = argTypes[argIdx]

This happens (at least, in my test case usage Telegram_12.0.0_APKPure.apk) on instruction "filled-new-array", where targetMethod is "new-array()".

instruction ['filled-new-array', 'v13', 'v11', 'v12', 'new-array()[I']
targetMethod new-array()[I
argIdxWithoutType [1, 2]
valueOfRegList [Primitive('0'), Primitive('1'), Primitive('2')]
argTypes ['new-array()[', '']
argIdx 2

new-array() does not have argument type aliases inside parentheses, so array argTypes is not filled.

rawArgTypes = targetMethod[
targetMethod.find("(") + 1 : targetMethod.find(")")
].split(" ")
for argType in rawArgTypes:
argTypes.append(argType)
if argType in ["J", "D"]:
# Put long and double twice
# because these types take up two registers.
argTypes.append(argType)

However, new-array does specify argument type after bracket, i.e. new-array()[I indicates, that it's array of integers, so maybe arguments should be parsed from there?

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingwork-in-progressThe issue or pull request is currently work-in-progress

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions