Skip to content

Mitigate UB when subtracting pointers#124

Open
eleviant wants to merge 1 commit intoaccess-softek:mainfrom
eleviant:subptr-in-mskernel
Open

Mitigate UB when subtracting pointers#124
eleviant wants to merge 1 commit intoaccess-softek:mainfrom
eleviant:subptr-in-mskernel

Conversation

@eleviant
Copy link
Copy Markdown
Contributor

@eleviant eleviant commented May 4, 2026

clang emits sdiv exact instruction, when subtracting pointers, assuming both of them belong to the same array and therefore are properly aligned. This is not the case, when we subtracting unrelated pointers, which may not be aligned to a type size.

clang emits sdiv exact instruction, when subtracting pointers, assuming
both of them belong to the same array and therefore are properly
aligned. This is not the case, when we subtracting unrelated pointers,
which may not be aligned to a type size.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant