This repository was archived by the owner on Mar 22, 2023. It is now read-only.
Commit 90c9428
committed
self_relative_ptr: fix UB when adding non-zero offset to possibly null pointer
Cast 'this' to integer type instead of casting to pointer type.
Original implementation resulted in the following error for
self_relative_ptr_atomic test:
"runtime error: pointer index expression with base 0x7ffc7773e7c0
overflowed to 0xfffffffffffffffe"1 parent 2153423 commit 90c9428
1 file changed
+3
-4
lines changedLines changed: 3 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
222 | 222 | | |
223 | 223 | | |
224 | 224 | | |
225 | | - | |
226 | | - | |
227 | | - | |
| 225 | + | |
| 226 | + | |
228 | 227 | | |
229 | 228 | | |
230 | 229 | | |
| |||
0 commit comments