Skip to content

Commit c67ab8f

Browse files
committed
C++: Respond to review comments.
1 parent e81b409 commit c67ab8f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
"qhelp.dtd">
44
<qhelp>
55
<overview>
6-
<p>Different overloads of the <code>new</code> operator handle allocation failures in different ways:
6+
<p>Different overloads of the <code>new</code> operator handle allocation failures in different ways.
77
If <code>new T</code> fails for some type <code>T</code>, it throws a <code>std::bad_alloc</code> exception,
8-
but <code>new(std::nothrow) T</code> returns a null pointer. If the programmer handles the wrong kind of
9-
failure, it could cause the program to behave in unexpected ways.</p>
8+
but <code>new(std::nothrow) T</code> returns a null pointer. If the programmer does not use the corresponding
9+
method of error handling, allocation failure may go unhandled and could cause the program to behave in
10+
unexpected ways.</p>
1011

1112
</overview>
1213
<recommendation>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/**
22
* @name Detect And Handle Memory Allocation Errors
3-
* @description `operator new` throws an exception on allocation failures, while `operator new(std::nothrow)` returns a null pointer.
4-
* Mixing up these two failure conditions can result in unexpected behavior.
3+
* @description `operator new` throws an exception on allocation failures, while `operator new(std::nothrow)` returns a null pointer. Mixing up these two failure conditions can result in unexpected behavior.
54
* @kind problem
65
* @id cpp/detect-and-handle-memory-allocation-errors
76
* @problem.severity warning

0 commit comments

Comments
 (0)