Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 25de82c

Browse files
ihsinmegeoffw0
andauthored
Apply suggestions from code review
Co-authored-by: Geoffrey White <[email protected]>
1 parent bec0064 commit 25de82c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
"qhelp.dtd">
44
<qhelp>
55
<overview>
6-
<p>when using the new operator to allocate memory, you need to pay attention to the different way of detecting errors. so <code> ::operator new(std::size_t) </code> throws an exception on error, and <code> ::operator new(std::size_t, const std::nothrow_t &) </code> returns zero on error. the programmer can get confused and check the error that occurs when allocating memory incorrectly. That can lead to an unhandled program termination or to a violation of the program logic.</p>
6+
<p>When using the <code>new</code> operator to allocate memory, you need to pay attention to the different ways of detecting errors. <code>::operator new(std::size_t)</code> throws an exception on error, whereas <code>::operator new(std::size_t, const std::nothrow_t &)</code> returns zero on error. The programmer can get confused and check the error that occurs when allocating memory incorrectly. That can lead to an unhandled program termination or to a violation of the program logic.</p>
77

88
<p>Loss of detection probably refers to use cases where memory allocation using your own solutions with strong nesting. It is also possible when using a buffer in the form of fields of different structures with the same names.</p>
99

1010
</overview>
1111
<recommendation>
1212

13-
<p>We recommend using the error detection method, depending on the selected memory allocation method.</code>.</p>
13+
<p>Use the correct error detection method corresponding with the memory allocation.</p>
1414

1515
</recommendation>
1616
<example>
17-
<p>The following file demonstrates various approaches to detecting memory allocation errors using the new operator.</p>
17+
<p>The following example demonstrates various approaches to detecting memory allocation errors using the <code>new</code> operator.</p>
1818
<sample src="WrongInDetectingAndHandlingMemoryAllocationErrors.cpp" />
1919

2020
</example>

0 commit comments

Comments
 (0)