joxeankoret / diaphora

Diaphora, the most advanced Free and Open Source program diffing tool.
http://diaphora.re
GNU Affero General Public License v3.0
3.58k stars 371 forks source link

IDA 8.0/Python 3.10: ValueError #241

Closed kwargsorg closed 1 year ago

kwargsorg commented 1 year ago

I've been consistently getting the following error with the latest build of Diaphora on IDA 8.0 for Linux with Python 3.10 when trying to produce a database for a file (and before diffing).

Error: Exceeds the limit (4300) for integer string conversion Traceback (most recent call last): File "/home/jpm/source/diaphora/diaphora_ida.py", line 2520, in _diff_or_export bd.export() File "/home/jpm/source/diaphora/diaphora_ida.py", line 868, in export self.do_export(crashed_before) File "/home/jpm/source/diaphora/diaphora_ida.py", line 823, in do_export props = self.read_function(func) File "/home/jpm/source/diaphora/diaphora_ida.py", line 2015, in read_function pseudocode_primes = str(self.pseudo_hash[f])

I recently upgraded Python from 3.9 to 3.10 which is the only significant change to my environment I can think of recently.

joxeankoret commented 1 year ago

Error: Exceeds the limit (4300) for integer string conversion

This is the very first time I see this error. Could you please share a sample?

kwargsorg commented 1 year ago

sample.zip

The password is "infected. It's malware so be careful!

Myles1 commented 1 year ago

I've run into the same issue. It can be resolved by adding this:

if hasattr(sys, "set_int_max_str_digits"):
    sys.set_int_max_str_digits(0)

I created a PR with that change here: https://github.com/joxeankoret/diaphora/pull/242

I think the underlying problem is with a recursive graph algorithm though.

joxeankoret commented 1 year ago

@kwargsorg I cannot reproduce it in Linux with IDA 8.0 or 8.1 and (a fresh installation of) Python 3.9 or 3.10 with the provided sample. Are you sure the sample you provided is the one triggering this error?

kwargsorg commented 1 year ago

sample2.zip

Here is another sample (64-bit) that triggers the same exception for me. I've also included the sqlite file that does get created. There is also a 0 byte sqlite crash file that is created.

joxeankoret commented 1 year ago

I can reproduce it, thank you! I will be fixing it soon.

joxeankoret commented 1 year ago

I have verified that the patch @Myles1 made works and I have just accepted it so this bug is fixed. Thank you both for reporting and helping fixing this issue!