Skip to content

Commit

Permalink
Do not dereference null pointer for no matching tests (#1191)
Browse files Browse the repository at this point in the history
When invoking for example

    test_c11_atomics test-that-does-not-exist

parseAndCallCommandLineTests() would attempt to dereference
`resultTestList` which is still a null pointer.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
  • Loading branch information
svenvh authored Mar 18, 2021
1 parent 6b36f64 commit dbd3e78
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions test_common/harness/testHarness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,20 +713,20 @@ int parseAndCallCommandLineTests(int argc, const char *argv[],
ret = saveResultsToJson(filename, argv[0], testList,
selectedTestList, resultTestList, testNum);
}
}

if (std::any_of(resultTestList, resultTestList + testNum,
[](test_status result) {
switch (result)
{
case TEST_PASS:
case TEST_SKIP: return false;
case TEST_FAIL:
default: return true;
};
}))
{
ret = EXIT_FAILURE;
if (std::any_of(resultTestList, resultTestList + testNum,
[](test_status result) {
switch (result)
{
case TEST_PASS:
case TEST_SKIP: return false;
case TEST_FAIL:
default: return true;
};
}))
{
ret = EXIT_FAILURE;
}
}

free(selectedTestList);
Expand Down

0 comments on commit dbd3e78

Please sign in to comment.