Skip to content

Commit 931b0f1

Browse files
jbjhubwriter
andauthored
Apply suggestions from code review
Co-Authored-By: Alistair <54933897+hubwriter@users.noreply.github.com>
1 parent 81d06e2 commit 931b0f1

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

cpp/ql/src/Likely Bugs/Memory Management/PointerOverflow.qhelp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
The expression <code>ptr + a &lt; ptr</code> is equivalent to <code>a &lt;
88
0</code>, and an optimizing compiler is likely to make that replacement,
99
thereby removing a range check that might have been necessary for security.
10-
If `a` is known to be non-negative, the compiler can even replace <code>ptr +
10+
If <code>a</code> is known to be non-negative, the compiler can even replace <code>ptr +
1111
a &lt; ptr</code> with <code>false</code>.
1212
</p>
1313

1414
<p>
1515
The reason is that pointer arithmetic overflow in C/C++ is undefined
1616
behavior. The optimizing compiler can assume that the program has no
17-
undefined behavior, which means that adding a positive number to `ptr` cannot
18-
produce a pointer less than `ptr`.
17+
undefined behavior, which means that adding a positive number to <code>ptr</code> cannot
18+
produce a pointer less than <code>ptr</code>.
1919
</p>
2020
</overview>
2121
<recommendation>
@@ -63,7 +63,7 @@ range of an allocation between <code>ptr</code> and <code>ptr_end</code>.
6363
<sample src="PointerOverflow-good.cpp" />
6464
</example>
6565
<references>
66-
<li><a href="https://blog.regehr.org/archives/1395">Pointer Overflow Checking [Embedded in Academia]</a></li>
67-
<li><a href="https://lwn.net/Articles/278137/">GCC and pointer overflows [LWN]</a></li>
66+
<li>Embedded in Academia: <a href="https://blog.regehr.org/archives/1395">Pointer Overflow Checking</a>.</li>
67+
<li>LWN: <a href="https://lwn.net/Articles/278137/">GCC and pointer overflows</a>.</li>
6868
</references>
6969
</qhelp>

0 commit comments

Comments
 (0)