Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResParserError: res1 must be zero! #78

Closed
Retr0-XX opened this issue Mar 15, 2024 · 1 comment · Fixed by #79
Closed

ResParserError: res1 must be zero! #78

Retr0-XX opened this issue Mar 15, 2024 · 1 comment · Fixed by #79

Comments

@Retr0-XX
Copy link

The parsing of the files stop when res1 is zero on some apks, which causes the analysis to completely stop.
A patch was implemented for androguard to make the analysis of the particular chunk stop, and log a warning instead:
https://github.com/androguard/androguard/pull/1008/files

I would suggest the replacement of the two assert statements at line in 129 pyaxmlparser/arscutil.py with the following:

res_error = False
if self.res0 != 0:
    log.warning("res0 is not zero!")
    res_error = True
if self.res1 != 0:
    log.warning("res1 is not zero!")
    res_error = True

if not res_error:  # Skips processing attempt if there was an error
    self.entryCount = unpack("<I", buff.read(4))[0]

    self.typespec_entries = []
    for i in range(0, self.entryCount):
        self.typespec_entries.append(unpack("<I", buff.read(4))[0])

And replace the assert statement at line 587 with the following:

if self.res0 != 0:
    log.warning("res0 is not zero!")
else:
    self.data_type = unpack('<B', buff.read(1))[0]
    self.data = unpack('<I', buff.read(4))[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants