diff options
author | Ryan Long <ryan.long@oarcorp.com> | 2021-08-12 14:59:50 -0400 |
---|---|---|
committer | Joel Sherrill <joel@rtems.org> | 2021-10-07 09:32:10 -0500 |
commit | 724505095ae634b485d1b1b8888b147e3a130ea0 (patch) | |
tree | 95631edb59e1254656aa81f876c3f0d2d3c8c896 /tester/covoar | |
parent | record-main-lttng.cc: Change size of empty string (diff) | |
download | rtems-tools-724505095ae634b485d1b1b8888b147e3a130ea0.tar.bz2 |
ReportsBase.cc: Add assert for member variables
The uncoveredRanges and uncoveredBranch member variables are allocated
as a pair. They are both either NULL or not NULL. Coverity does not know
this though, so this assert is added to ensure they are not NULL before
being dereferenced.
CID 1503710: Dereference after null check
Closes #4428
Diffstat (limited to 'tester/covoar')
-rw-r--r-- | tester/covoar/ReportsBase.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tester/covoar/ReportsBase.cc b/tester/covoar/ReportsBase.cc index bc05037..219e5af 100644 --- a/tester/covoar/ReportsBase.cc +++ b/tester/covoar/ReportsBase.cc @@ -3,6 +3,7 @@ #include <errno.h> #include <sys/stat.h> #include <sys/types.h> +#include <assert.h> #include <iomanip> #include <sstream> @@ -231,6 +232,10 @@ void ReportsBase::WriteAnnotatedReport( const std::string& fileName ) continue; } + // uncoveredRanges and uncoveredBranches are always allocated as a pair + // so both are NULL or both are not NULL. + assert( info.uncoveredRanges != NULL && info.uncoveredBranches != NULL ); + // If uncoveredRanges and uncoveredBranches are empty, then everything // must have been covered for this symbol. Just skip it. if ( |