NationalSecurityAgency / ghidra

Ghidra is a software reverse engineering (SRE) framework
https://www.nsa.gov/ghidra
Apache License 2.0
51.12k stars 5.82k forks source link

NullPointerException in AbstractCppClassAnalyzer while analyzing libstdc++ #1750

Closed TheAifam5 closed 4 years ago

TheAifam5 commented 4 years ago

Describe the bug Importing 64-bit libstdc++.so.6 on ArchLinux from /usr/lib/libstdc++.so.6 throws a single dialog with a text java.lang.NullPointerException with no callstack or any useful error information. In Attachments section I added the log with the callstack.

To Reproduce Steps to reproduce the behavior:

  1. Load libstdc++.so.6
  2. Analyze with default options

Expected behavior IMHO should show more detailed error message like every other plugin does when crashing (I mean the expand button to see more). I don't know if that affected the analysis but such thing should not exists.

Attachments ArchLinux package containing that file (gcc-libs 9.3.0-1): https://www.archlinux.org/packages/core/x86_64/gcc-libs/

2020-04-12  04:09:12    ERROR   (MessageLog) Exception appended to MessageLog java.lang.NullPointerException
            at ghidra.app.plugin.prototype.CppCodeAnalyzerPlugin.AbstractCppClassAnalyzer.analyzeDestructor(AbstractCppClassAnalyzer.java:241)
            at ghidra.app.plugin.prototype.CppCodeAnalyzerPlugin.AbstractCppClassAnalyzer.fillStructures(AbstractCppClassAnalyzer.java:186)
            at ghidra.app.plugin.prototype.CppCodeAnalyzerPlugin.AbstractCppClassAnalyzer.added(AbstractCppClassAnalyzer.java:108)
            at ghidra.app.plugin.core.analysis.AnalysisScheduler.runAnalyzer(AnalysisScheduler.java:190)
            at ghidra.app.plugin.core.analysis.AnalysisTask.applyTo(AnalysisTask.java:39)
            at ghidra.app.plugin.core.analysis.AutoAnalysisManager$AnalysisTaskWrapper.run(AutoAnalysisManager.java:685)
            at ghidra.app.plugin.core.analysis.AutoAnalysisManager.startAnalysis(AutoAnalysisManager.java:785)
            at ghidra.app.plugin.core.analysis.AutoAnalysisManager.startAnalysis(AutoAnalysisManager.java:664)
            at ghidra.app.plugin.core.analysis.AutoAnalysisManager.startAnalysis(AutoAnalysisManager.java:629)
            at ghidra.app.plugin.core.analysis.AnalysisBackgroundCommand.applyTo(AnalysisBackgroundCommand.java:58)
            at ghidra.framework.plugintool.mgr.BackgroundCommandTask.run(BackgroundCommandTask.java:101)
            at ghidra.framework.plugintool.mgr.ToolTaskManager.run(ToolTaskManager.java:315)
            at java.base/java.lang.Thread.run(Thread.java:830)

Environment (please complete the following information):

mumbel commented 4 years ago

this is not a bug in ghidra and not something that can be fixed here, you should file a bug with the plugin. (just curious is arch packaging this w/ ghidra or did you install it?, edit: nvmd just noticed you're on bcb825f)

https://github.com/astrelsky/Ghidra-Cpp-Class-Analyzer

astrelsky commented 4 years ago

Yes this is my fault.

I guess I should make it clear that it came from my plugin before appending something to the message log.

Just for clarification, this is occurring on import?

TheAifam5 commented 4 years ago

Oh... I wasnt sure about that from where that error even comes. It occurs while analyzing: All options default + GCC RTTI (Fundamental Types) + C++ Class Analyzer (Fill Class Fields and Locate Constructors)

I am going to open the issue in astrelsky/Ghidra-Cpp-Class-Analyzer since is not Ghidra related.