We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6940157 commit 53a106fCopy full SHA for 53a106f
clang/docs/ReleaseNotes.rst
@@ -71,7 +71,10 @@ code bases.
71
72
To avoid pointer addition overflow, it is necessary to perform the addition
73
on integers, for example using
74
- ``(uintptr_t)ptr + unsigned_offset < (uintptr_t)ptr``.
+ ``(uintptr_t)ptr + unsigned_offset < (uintptr_t)ptr``. Sometimes, it is also
75
+ possible to rewrite checks by only comparing the offset. For example,
76
+ ``ptr + offset < end_ptr && ptr + offset >= ptr`` can be written as
77
+ ``offset < (uintptr_t)(end_ptr - ptr)``.
78
79
Undefined behavior due to pointer addition overflow can be reliably detected
80
using ``-fsanitize=pointer-overflow``. It is also possible to use
0 commit comments