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

Unlimited recursion at ghidra::Heritage::renameRecurse causing decompiler crash #7321

Open
davendu opened this issue Dec 27, 2024 · 0 comments
Assignees
Labels
Feature: Decompiler Status: Triage Information is being gathered

Comments

@davendu
Copy link

davendu commented Dec 27, 2024

Describe the bug

The file attached will result in crash of the decompiler process, caused by unlimited recursion.

To Reproduce
Steps to reproduce the behavior:

  1. Import attached file to new project (password: sample):
    sample_7469c86cbc9bf9233e05c633954a4465b0a1e51ff08b7b80dea02ee7243eadf1.zip
  2. Start autoanalyze with default settings
  3. Wait for coredump

Expected behavior

Decompiler runs normally.

Screenshots

Coredump info:

> coredumpctl debug 13989
           PID: 13989 (decompile)
        Signal: 11 (SEGV)
  Command Line: /home/user/ghidra/ghidra_11.2.1_PUBLIC/Ghidra/Features/Decompiler/os/linux_x86_64/decompile
    Executable: /home/user/ghidra/ghidra_11.2.1_PUBLIC/Ghidra/Features/Decompiler/os/linux_x86_64/decompile

(gdb)  bt 10
#0  0x0000749e67eb1a34 in _int_free (av=0x749e67ff6ac0 <main_arena>, p=p@entry=0x26da52a0, have_lock=have_lock@entry=0x0) at malloc.c:4499
#1  0x0000749e67eb45ce in __GI___libc_free (mem=0x26da52b0) at malloc.c:3398
#2  0x0000000000513966 in ghidra::Varnode::eraseDescend(ghidra::PcodeOp*) ()
#3  0x00000000004ed1a7 in ghidra::Funcdata::opSetInput(ghidra::PcodeOp*, ghidra::Varnode*, int) ()
#4  0x0000000000593ffc in ghidra::Heritage::renameRecurse(ghidra::BlockBasic*, std::map<ghidra::Address, std::vector<ghidra::Varnode*, std::allocator<ghidra::Varnode*> >, std::less<ghidra::Address>, std::allocator<std::pair<ghidra::Address const, std::vector<ghidra::Varnode*, std::allocator<ghidra::Varnode*> > > > >&) ()
#5  0x000000000059437c in ghidra::Heritage::renameRecurse(ghidra::BlockBasic*, std::map<ghidra::Address, std::vector<ghidra::Varnode*, std::allocator<ghidra::Varnode*> >, std::less<ghidra::Address>, std::allocator<std::pair<ghidra::Address const, std::vector<ghidra::Varnode*, std::allocator<ghidra::Varnode*> > > > >&) ()
#6  0x000000000059437c in ghidra::Heritage::renameRecurse(ghidra::BlockBasic*, std::map<ghidra::Address, std::vector<ghidra::Varnode*, std::allocator<ghidra::Varnode*> >, std::less<ghidra::Address>, std::allocator<std::pair<ghidra::Address const, std::vector<ghidra::Varnode*, std::allocator<ghidra::Varnode*> > > > >&) ()
#7  0x000000000059437c in ghidra::Heritage::renameRecurse(ghidra::BlockBasic*, std::map<ghidra::Address, std::vector<ghidra::Varnode*, std::allocator<ghidra::Varnode*> >, std::less<ghidra::Address>, std::allocator<std::pair<ghidra::Address const, std::vector<ghidra::Varnode*, std::allocator<ghidra::Varnode*> > > > >&) ()
#8  0x000000000059437c in ghidra::Heritage::renameRecurse(ghidra::BlockBasic*, std::map<ghidra::Address, std::vector<ghidra::Varnode*, std::allocator<ghidra::Varnode*> >, std::less<ghidra::Address>, std::allocator<std::pair<ghidra::Address const, std::vector<ghidra::Varnode*, std::allocator<ghidra::Varnode*> > > > >&) ()
#9  0x000000000059437c in ghidra::Heritage::renameRecurse(ghidra::BlockBasic*, std::map<ghidra::Address, std::vector<ghidra::Varnode*, std::allocator<ghidra::Varnode*> >, std::less<ghidra::Address>, std::allocator<std::pair<ghidra::Address const, std::vector<ghidra::Varnode*, std::allocator<ghidra::Varnode*> > > > >&) ()
(More stack frames follow...)
#40307 0x000000000059437c in ghidra::Heritage::renameRecurse(ghidra::BlockBasic*, std::map<ghidra::Address, std::vector<ghidra::Varnode*, std::allocator<ghidra::Varnode*> >, std::less<ghidra::Address>, std::allocator<std::pair<ghidra::Address const, std::vector<ghidra::Varnode*, std::allocator<ghidra::Varnode*> > > > >&) ()
#40308 0x000000000059437c in ghidra::Heritage::renameRecurse(ghidra::BlockBasic*, std::map<ghidra::Address, std::vector<ghidra::Varnode*, std::allocator<ghidra::Varnode*> >, std::less<ghidra::Address>, std::allocator<std::pair<ghidra::Address const, std::vector<ghidra::Varnode*, std::allocator<ghidra::Varnode*> > > > >&) ()
#40309 0x000000000059437c in ghidra::Heritage::renameRecurse(ghidra::BlockBasic*, std::map<ghidra::Address, std::vector<ghidra::Varnode*, std::allocator<ghidra::Varnode*> >, std::less<ghidra::Address>, std::allocator<std::pair<ghidra::Address const, std::vector<ghidra::Varnode*, std::allocator<ghidra::Varnode*> > > > >&) ()
#40310 0x0000000000594669 in ghidra::Heritage::rename() ()
#40311 0x00000000005949bf in ghidra::Heritage::heritage() ()
#40312 0x000000000049d3a0 in ghidra::ActionHeritage::apply(ghidra::Funcdata&) ()
#40313 0x000000000056f1fe in ghidra::Action::perform(ghidra::Funcdata&) ()
#40314 0x000000000056f2fe in ghidra::ActionGroup::apply(ghidra::Funcdata&) ()
#40315 0x000000000056f1fe in ghidra::Action::perform(ghidra::Funcdata&) ()
#40316 0x000000000056f2fe in ghidra::ActionGroup::apply(ghidra::Funcdata&) ()
#40317 0x000000000056f1fe in ghidra::Action::perform(ghidra::Funcdata&) ()
#40318 0x000000000056f2fe in ghidra::ActionGroup::apply(ghidra::Funcdata&) ()
#40319 0x000000000056fc0b in ghidra::ActionRestartGroup::apply(ghidra::Funcdata&) ()
#40320 0x000000000056f1fe in ghidra::Action::perform(ghidra::Funcdata&) ()
#40321 0x000000000054d1b4 in ghidra::DecompileAt::rawAction() ()
#40322 0x000000000054de4a in ghidra::GhidraCommand::doit() ()
#40323 0x000000000054e037 in ghidra::GhidraCapability::readCommand(std::basic_istream<char, std::char_traits<char> >&, std::basic_ostream<char, std::char_traits<char> >&) ()
#40324 0x0000000000426b87 in main ()

Attachments

password: sample:
sample_7469c86cbc9bf9233e05c633954a4465b0a1e51ff08b7b80dea02ee7243eadf1.zip

Environment (please complete the following information):

  • OS: Latest Linux LTS Kernel
  • Java Version: openjdk 11.0.25 2024-10-15
  • Ghidra Version: 11.2.1
  • Ghidra Origin: official GitHub distro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: Decompiler Status: Triage Information is being gathered
Projects
None yet
Development

No branches or pull requests

3 participants