Skip to content

Commit e9e93c0

Browse files
authored
Merge pull request github#5558 from geoffw0/replace-tostring
Replace toString use
2 parents 49d1937 + 85ecfe2 commit e9e93c0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

cpp/ql/src/experimental/Security/CWE/CWE-570/WrongInDetectingAndHandlingMemoryAllocationErrors.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ class WrongCheckErrorOperatorNew extends FunctionCall {
7272
}
7373

7474
/**
75-
* Holds if `(std::nothrow)` exists in call `operator new`.
75+
* Holds if `(std::nothrow)` or `(std::noexcept)` exists in call `operator new`.
7676
*/
77-
predicate isExistsNothrow() { this.getAChild().toString() = "nothrow" }
77+
predicate isExistsNothrow() { getTarget().isNoExcept() or getTarget().isNoThrow() }
7878
}
7979

8080
from WrongCheckErrorOperatorNew op

cpp/ql/test/experimental/query-tests/Security/CWE/CWE-570/semmle/tests/test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ using namespace std;
1414

1515
void* operator new(std::size_t _Size);
1616
void* operator new[](std::size_t _Size);
17-
void* operator new( std::size_t count, const std::nothrow_t& tag );
18-
void* operator new[]( std::size_t count, const std::nothrow_t& tag );
17+
void* operator new( std::size_t count, const std::nothrow_t& tag ) noexcept;
18+
void* operator new[]( std::size_t count, const std::nothrow_t& tag ) noexcept;
1919

2020
void badNew_0_0()
2121
{

0 commit comments

Comments
 (0)