clearbluejar / ghidriff

Python Command-Line Ghidra Binary Diffing Engine

Home Page:https://clearbluejar.github.io/ghidriff/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Division By Zero Traceback

whoismissing opened this issue · comments

I've found it's possible when running ghidriff bin1 bin2 to get a ZeroDivisionError

Traceback (most recent call last):
  File "/home/wsl2/Envs/bd/bin/ghidriff", line 8, in <module>
    sys.exit(main())
  File "/home/wsl2/Envs/bd/lib/python3.10/site-packages/ghidriff/__main__.py", line 87, in main
    pdiff = d.diff_bins(diff[0], diff[1])
  File "/home/wsl2/Envs/bd/lib/python3.10/site-packages/ghidriff/ghidra_diff_engine.py", line 1491, in diff_bins
    match_func_similarity_percent = f'{((matched_funcs_no_changes_len / matched_funcs_len)*100):.4f}%'
ZeroDivisionError: division by zero

ah good find. I'll add a test case for this.

I am having a really difficult time finding a div by zero test case, so I just added some checks around the divisors.

Can you share a copy of the bins that cause this error?