astrelsky / Ghidra-Cpp-Class-Analyzer

Ghidra C++ Class and Run Time Type Information Analyzer
MIT License
633 stars 46 forks source link

ArrayIndexOutOfBounds #12

Closed TheAifam5 closed 4 years ago

TheAifam5 commented 4 years ago

Version: 2c8427e593777b0c6cd9ad9d75d579502a628fed System: ArchLinux Ghidra: 9.2 (master)

2020-04-08  01:31:43    DEBUG   (MessageLog) Exception appended to MessageLog java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
            at ghidra.app.cmd.data.rtti.gcc.ClassTypeInfoUtils.sortByMostDerived(ClassTypeInfoUtils.java:327)
            at ghidra.app.plugin.prototype.GccRttiAnalyzer.createVtables(GccRttiAnalyzer.java:272)
            at ghidra.app.plugin.prototype.GccRttiAnalyzer.added(GccRttiAnalyzer.java:149)
            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)
astrelsky commented 4 years ago

Version: 2c8427e System: ArchLinux Ghidra: 9.2 (master)

2020-04-08    01:31:43    DEBUG   (MessageLog) Exception appended to MessageLog java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
          at ghidra.app.cmd.data.rtti.gcc.ClassTypeInfoUtils.sortByMostDerived(ClassTypeInfoUtils.java:327)
          at ghidra.app.plugin.prototype.GccRttiAnalyzer.createVtables(GccRttiAnalyzer.java:272)
          at ghidra.app.plugin.prototype.GccRttiAnalyzer.added(GccRttiAnalyzer.java:149)
          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)

I think I tracked down the cause. It has to do with the recent Demangler changes or my misunderstanding.

May you try the recent two commits and see if this resolves the issue here? This might actually resolve several issues. I've been using the analyzer to "debug" code for an embedded system for my senior project and I'm surprised I hadn't noticed the issue.

TheAifam5 commented 4 years ago

The error disappeared (I'm on 0733e401526f48a6af6c269f55faaecd7604eee2) but now shows new error (wasnt present on 2c8427e). Feel free to close this issue, since the following part is related to the https://github.com/astrelsky/Ghidra-Cpp-Class-Analyzer/issues/14