question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

InvalidDataTypeException when parsing std classes

See original GitHub issue

I try to analyze a VS C++ binary with Windows C++ Class Analyzer and get this exception:

ghidra.program.model.data.InvalidDataTypeException: Invalid ClassTypeInfo
	at ghidra.app.plugin.prototype.CppCodeAnalyzerPlugin.wrappers.RttiModelWrapper.validate(RttiModelWrapper.java:154)
	at ghidra.app.plugin.prototype.CppCodeAnalyzerPlugin.wrappers.RttiModelWrapper.getParentModels(RttiModelWrapper.java:222)
	at ghidra.app.cmd.data.rtti.gcc.ClassTypeInfoUtils.sortByMostDerived(ClassTypeInfoUtils.java:328)
	at ghidra.app.plugin.prototype.CppCodeAnalyzerPlugin.AbstractCppClassAnalyzer.analyzeVftables(AbstractCppClassAnalyzer.java:298)
	at ghidra.app.plugin.prototype.CppCodeAnalyzerPlugin.windows.WindowsCppClassAnalyzer.analyzeVftables(WindowsCppClassAnalyzer.java:99)
	at ghidra.app.plugin.prototype.CppCodeAnalyzerPlugin.AbstractCppClassAnalyzer.added(AbstractCppClassAnalyzer.java:102)
	at ghidra.app.plugin.core.analysis.OneShotAnalysisCommand.applyTo(OneShotAnalysisCommand.java:47)
	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:62)
	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:834)

The exception is generated by the extension, so this should be some valid signaling, not some programming error. Although all members of the RttiModelWrapper object are null (so the causing program structures are not easy to identify), this problem can be in connection with previous “Input model invalid” messages generated by the RttiModelWrapper constructor when parsing std::basic_ifstream and std::basic_ofstream class information.

I assume this can be handled by catching the exception in the calling function (getParentModels()) but I’m not yet familiar with the code so I wouldn’t immediately create a PR for this.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
astrelskycommented, Jan 4, 2020

I just took care of a bunch of exceptions due to my own carelessness. There are still some cases of unresolved inheritance and I definitely need to refactor the RttiModelWrapper.

0reactions
v-p-bcommented, Jan 5, 2020

Thanks, looking good!

Read more comments on GitHub >

github_iconTop Results From Across the Web

What type of std::exception should be thrown when reading a ...
It is possible to throw any object (from any class) as an exception but deriving custom exceptions from std::exception is considered good ...
Read more >
Class invalid flag vs exception
Exceptions are a way of signaling that your code cannot complete the requested operation. Perhaps something was null that you never expected ...
Read more >
InvalidDataException Class (System.IO) - Microsoft Learn
Initializes a new instance of the InvalidDataException class with a reference to the inner exception that is the cause of this exception.
Read more >
How to Handle the Incompatible Types Error in Java - Rollbar
The Java incompatible types error happens when a value assigned to a variable or returned by a method is incompatible with the one...
Read more >
7.16 — std::cin and handling invalid input - Learn C++
A failed extraction due to invalid input will cause the variable to be zero-initialized. Zero initialization means the variable is set to 0,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found