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

Handling pathological Python programs with thousands statements in a block - RuntimeError: maximum recursion depth exceeded in cmp #70

Open
lelicopter opened this issue Nov 29, 2016 · 2 comments

Comments

@lelicopter
Copy link
Contributor

lelicopter commented Nov 29, 2016

.pyc script doesn't have any opcodes for compare.
source code like:
TEXT_ACCOUNT_545 = ' '
TEXT_ACCOUNT_550 = ' \n %s%s\n %s%s'
TEXT_ACCOUNT_560 = ' '
TEXT_ACCOUNT_564 = '\xd0\x9e\xd0\x9a '
TEXT_APPSETTING_503 = ' '
TEXT_APPSETTING_506 = ' '
etc.
.pyc for debug this bug is: http://rgho.st/6KbCGMX7D (new link)

@rocky rocky changed the title RuntimeError: maximum recursion depth exceeded in cmp Handling patholocial Python programs with thousands statements in a block - RuntimeError: maximum recursion depth exceeded in cmp Nov 30, 2016
@rocky
Copy link
Owner

rocky commented Nov 30, 2016

While this is a bug, it is a very pathological case. A file with something like 10K lines of assignment statements.

Something along the lines of this patch
unc-bug.txt

will remove the recursion problem, but the run time is pretty slow.

I don't have the time to work on this in the near future. However, since this seems to be about decoding some sort of game file, maybe you have time to start with the patch and revise as necessary.

@rocky rocky changed the title Handling patholocial Python programs with thousands statements in a block - RuntimeError: maximum recursion depth exceeded in cmp Handling pathological Python programs with thousands statements in a block - RuntimeError: maximum recursion depth exceeded in cmp Dec 15, 2016
@rocky
Copy link
Owner

rocky commented Jul 9, 2022

I now understand how to address this in using the ambiguous grammar Earley parser.

https://github.com/rocky/python-decompile3/tree/stmt-block has experimental code. However this will probably only really be addressed when better basic-block handling is incorporated since the key inside revolves around basic-block detection.

As Chet Ramey quotes:

`The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates

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

No branches or pull requests

2 participants