When I was packaging rz-ghidra for GNU Guix I've ran into a difficult issue which made me build the whole suite in debug mode and run it through gdb, because of no meaningfull error massage on abort.
Steps to reproduce:
$ cutter --no-rizin-plugins --no-output-redirect ./a.out
normal output for loading plugins/analizing
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_M_construct null not valid
aborted
Or just make sure that Rizin part of the plugin isn't where Rizin looks for plugins.
The issue comes from src/core_ghidra.cpp and is caused by
std::string ConfigVar::GetString(RzConfig *cfg) const { return rz_config_get(cfg, name.c_str()); }
constructing a std::string from NULL, returned by rz_config_get with "ghidra.lang", which basically means that Rizin didn't load the plugin. But rather than giving us a meaning full message and continuing to operate normaly, the program aborts.
Possible solutions:
- At least print error message in
ConfigVar::GetString or rz_config_get, when variables are not found.
- Make Cutter check for it's plugins dependencies on Rizin plugins and just show a warning and don't use the plugin when they're not met.
I've ran into this issue basically because Cutter does a way better job of loading it's plugins, while Rizin looks into at most 3 directories (RZ_LIB_PLUGINS, RZ_EXTRA_PLUGINS, RZ_USER_PLUGINS), which are set in stone when you build Rizin. So a possible improvement is to port Cutter's plugin loading system to Rizin.
I've chosen to post this issue in this repository because the actual exceptions isn't being caugh in it's code, but as you can see from my elaboration, the issue concers Rizin and Cutter as well.
When I was packaging rz-ghidra for GNU Guix I've ran into a difficult issue which made me build the whole suite in debug mode and run it through gdb, because of no meaningfull error massage on abort.
Steps to reproduce:
Or just make sure that Rizin part of the plugin isn't where Rizin looks for plugins.
The issue comes from
src/core_ghidra.cppand is caused bystd::string ConfigVar::GetString(RzConfig *cfg) const { return rz_config_get(cfg, name.c_str()); }constructing a
std::stringfromNULL, returned byrz_config_getwith"ghidra.lang", which basically means that Rizin didn't load the plugin. But rather than giving us a meaning full message and continuing to operate normaly, the program aborts.Possible solutions:
ConfigVar::GetStringorrz_config_get, when variables are not found.I've ran into this issue basically because Cutter does a way better job of loading it's plugins, while Rizin looks into at most 3 directories (
RZ_LIB_PLUGINS,RZ_EXTRA_PLUGINS,RZ_USER_PLUGINS), which are set in stone when you build Rizin. So a possible improvement is to port Cutter's plugin loading system to Rizin.I've chosen to post this issue in this repository because the actual exceptions isn't being caugh in it's code, but as you can see from my elaboration, the issue concers Rizin and Cutter as well.