OpenSCAP / scap-workbench

SCAP Scanner And Tailoring Graphical User Interface
https://www.open-scap.org/tools/scap-workbench
GNU General Public License v3.0
226 stars 65 forks source link

SCAP Workbench contains uncaught exceptions #207

Open jan-cerny opened 6 years ago

jan-cerny commented 6 years ago

My opinion is that we should catch these exceptions and display meaningful messages to the user.

Error: UNCAUGHT_EXCEPT (CWE-248):
scap-workbench-1.2.0/src/main.cpp:30: root_function: In function "main(int, char **)" an exception of type "MainWindowException" is thrown and never caught.
scap-workbench-1.2.0/src/main.cpp:41: fun_call_w_exception: Called function throws an exception of type "MainWindowException".
scap-workbench-1.2.0/src/Application.cpp:60:5: fun_call_w_exception: Called function throws an exception of type "MainWindowException".
scap-workbench-1.2.0/src/Application.cpp:114:9: fun_call_w_exception: Called function throws an exception of type "MainWindowException".
scap-workbench-1.2.0/src/MainWindow.cpp:544:9: exception_thrown: An exception of type "MainWindowException" is thrown.
#  542|   {
#  543|       if (!fileOpened())
#  544|->         throw MainWindowException("Can't load a tailoring file, SCAP input hasn't been loaded yet.");
#  545|   
#  546|       mScanningSession->setTailoringFile(path);

Error: UNCAUGHT_EXCEPT (CWE-248):
scap-workbench-1.2.0/src/RemoteSsh.cpp:55: exn_spec_violation: An exception of type "SyncProcessException" is thrown but the throw list "throw()" doesn't allow it to be thrown. This will cause a call to unexpected() which usually calls terminate().
scap-workbench-1.2.0/src/RemoteSsh.cpp:58: fun_call_w_exception: Called function throws an exception of type "SyncProcessException".
scap-workbench-1.2.0/src/RemoteSsh.cpp:196:9: fun_call_w_exception: Called function throws an exception of type "SyncProcessException".
scap-workbench-1.2.0/src/ProcessHelpers.cpp:89:9: exception_thrown: An exception of type "SyncProcessException" is thrown.
#   87|   {
#   88|       if (isRunning())
#   89|->         throw SyncProcessException("Already running, can't change command!");
#   90|   
#   91|       mCommand = command;

Error: UNCAUGHT_EXCEPT (CWE-248):
scap-workbench-1.2.0/src/RemoteSsh.cpp:55: exn_spec_violation: An exception of type "SshConnectionException" is thrown but the throw list "throw()" doesn't allow it to be thrown. This will cause a call to unexpected() which usually calls terminate().
scap-workbench-1.2.0/src/RemoteSsh.cpp:58: fun_call_w_exception: Called function throws an exception of type "SshConnectionException".
scap-workbench-1.2.0/src/RemoteSsh.cpp:177:9: exception_thrown: An exception of type "SshConnectionException" is thrown.
#  175|   {
#  176|       if (!isConnected())
#  177|->         throw SshConnectionException(
#  178|               "Not connected, makes no sense to disconnect!");
#  179|   

Error: UNCAUGHT_EXCEPT (CWE-248):
scap-workbench-1.2.0/src/MainWindow.cpp:291: exn_spec_violation: An exception of type "RuleResultsTreeException" is thrown but the throw list "throw()" doesn't allow it to be thrown. This will cause a call to unexpected() which usually calls terminate().
scap-workbench-1.2.0/src/MainWindow.cpp:298: fun_call_w_exception: Called function throws an exception of type "RuleResultsTreeException".
scap-workbench-1.2.0/src/MainWindow.cpp:838:5: fun_call_w_exception: Called function throws an exception of type "RuleResultsTreeException".
scap-workbench-1.2.0/src/MainWindow.cpp:327:5: fun_call_w_exception: Called function throws an exception of type "RuleResultsTreeException".
scap-workbench-1.2.0/src/RuleResultsTree.cpp:148:9: fun_call_w_exception: Called function throws an exception of type "RuleResultsTreeException".
scap-workbench-1.2.0/src/RuleResultsTree.cpp:168:9: exception_thrown: An exception of type "RuleResultsTreeException" is thrown.
#  166|       RuleResultItem* item = mRuleIdToWidgetItemMap[ruleID];
#  167|       if (!item)
#  168|->         throw RuleResultsTreeException(
#  169|               QString("Could not find rule of ID '%1'. Result of this rule was '%2' but it can't be reported! "
#  170|                       "This could be a difference between remote and local openscap versions or a bug in "
mpreisler commented 6 years ago

All of these seem "exceptional" to me. They indicate internal bugs in SCAP Workbench. We could catch them in main() but that would make only a very small difference.