Skip to content

Commit af81698

Browse files
committed
C++: Fix FP and accept test changes.
1 parent 91f860b commit af81698

File tree

3 files changed

+2
-2
lines changed

3 files changed

+2
-2
lines changed

cpp/ql/src/Security/CWE/CWE-416/UseOfUniquePointerAfterLifetimeEnds.ql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ where
3030
outlivesFullExpr(c) and
3131
not c.isFromUninstantiatedTemplate(_) and
3232
isUniquePointerDerefFunction(c.getTarget()) and
33+
not c.getActualType() instanceof BoolType and
3334
isTemporary(c.getQualifier().getFullyConverted())
3435
select c,
3536
"The underlying unique pointer object is destroyed after the call to '" + c.getTarget() +

cpp/ql/test/query-tests/Security/CWE/CWE-416/semmle/tests/UseOfUniquePtrAfterLifetimeEnds/UseOfUniquePointerAfterLifetimeEnds.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@
99
| test.cpp:177:16:177:16 | call to operator* | The underlying unique pointer object is destroyed after the call to 'operator*' returns. |
1010
| test.cpp:177:36:177:36 | call to operator* | The underlying unique pointer object is destroyed after the call to 'operator*' returns. |
1111
| test.cpp:179:11:179:11 | call to operator* | The underlying unique pointer object is destroyed after the call to 'operator*' returns. |
12-
| test.cpp:209:29:209:31 | call to get | The underlying unique pointer object is destroyed after the call to 'get' returns. |

cpp/ql/test/query-tests/Security/CWE/CWE-416/semmle/tests/UseOfUniquePtrAfterLifetimeEnds/test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ void test2(bool b1, bool b2) {
206206
}
207207

208208
void test_convert_to_bool() {
209-
bool b = get_unique_ptr().get(); // GOOD [FALSE POSITIVE]
209+
bool b = get_unique_ptr().get(); // GOOD
210210

211211
if(get_unique_ptr().get()) { // GOOD
212212

0 commit comments

Comments
 (0)