rizinorg / cutter

Free and Open Source Reverse Engineering Platform powered by rizin
https://cutter.re
GNU General Public License v3.0
15.4k stars 1.14k forks source link

Crash when renaming local variable/function parameter. (Types API related?) #2747

Closed cg9999 closed 2 years ago

cg9999 commented 2 years ago

Environment information

Describe the bug

Cutter crashes when trying to open the rename local variable dialog

To Reproduce

Steps to reproduce the behavior:

  1. Open attached .bin file with cutter
  2. load attached header file with 'to /path/to/behemoth.h'
  3. On disassembly window, right click entry0 function arg2 parameter, select Rename local arg2
  4. crash

short backtrace: (full is included in the zip)

#0  0x00007f9740da9c0a in __strlen_sse2 () from /usr/lib/libc.so.6
#1  0x00007f9740d77fd8 in __vfprintf_internal () from /usr/lib/libc.so.6
#2  0x00007f9740d88f8a in __vsnprintf_internal () from /usr/lib/libc.so.6
#3  0x00007f97433f958c in rz_strbuf_vappendf (sb=0x55e06901a960, fmt=0x7f974208af11 "%s ", ap=0x7ffcba3db200)
    at ../../../../rizin/librz/util/strbuf.c:290
#4  0x00007f97433f9487 in rz_strbuf_appendf (sb=0x55e06901a960, fmt=0x7f974208af11 "%s ") at ../../../../rizin/librz/util/strbuf.c:274
#5  0x00007f9742046593 in type_to_format_pair (typedb=0x55e067a9e190, format=0x55e068fc3000, fields=0x55e06901a960, identifier=0x0, 
    type=0x7f971ca169e0) at ../../../../rizin/librz/type/format.c:3019
#6  0x00007f9742045fe5 in base_type_to_format_unfold (typedb=0x55e067a9e190, type=0x7f971ca1dfb0, format=0x55e068fc3000, fields=0x55e06901a960, 
    identifier=0x0) at ../../../../rizin/librz/type/format.c:2899
#7  0x00007f97420460e7 in rz_base_type_as_format (typedb=0x55e067a9e190, type=0x7f971ca1dfb0) at ../../../../rizin/librz/type/format.c:2923
#8  0x00007f97420461c3 in rz_type_format (typedb=0x55e067a9e190, name=0x7f971ca16b50 "EFI_DECOMPRESS_GET_INFO")
    at ../../../../rizin/librz/type/format.c:2946
#9  0x000055e06601cf50 in CutterCore::getBaseType (this=0x55e06649b840 <(anonymous namespace)::Q_QGS_uniqueInstance::innerFunction()::holder>, 
    kind=RZ_BASE_TYPE_KIND_TYPEDEF, category=0x55e0662a3e43 "Typedef") at /home/cromos/projects/rizin/cutter/src/core/Cutter.cpp:3536
#10 0x000055e06601d20e in CutterCore::getAllTypedefs (this=0x55e06649b840 <(anonymous namespace)::Q_QGS_uniqueInstance::innerFunction()::holder>)
    at /home/cromos/projects/rizin/cutter/src/core/Cutter.cpp:3567
#11 0x000055e0661d4193 in EditVariablesDialog::populateTypesComboBox (this=0x7ffcba3db650)
    at /home/cromos/projects/rizin/cutter/src/dialogs/EditVariablesDialog.cpp:99
#12 0x000055e0661d383e in EditVariablesDialog::EditVariablesDialog (this=0x7ffcba3db650, offset=6442453432, initialVar=..., parent=0x55e067cc3a70)

Files can be found here: bug.zip

XVilka commented 2 years ago

Should be fixed with the update to the latest stable Rizin branch: https://github.com/rizinorg/rizin/commit/978a06b7f67a841ca43e960d7adf2eeb16a74d44

cg9999 commented 2 years ago

Seems to work fine now. Thanks!