Skip to content

ubsan fixes, alignment in u3a_pile - #1072

Open
dozreg-toplud wants to merge 2 commits into
developfrom
dozreg/ubsan
Open

ubsan fixes, alignment in u3a_pile#1072
dozreg-toplud wants to merge 2 commits into
developfrom
dozreg/ubsan

Conversation

@dozreg-toplud

Copy link
Copy Markdown
Contributor

Strange CI behavior in #1071 prompted me to run CI tests locally with UBSan, and fix all places where it complained.

The most substantial fix is introduction of alignment in u3a_pile. I have a faint memory that something like this was supposed to be added to Vere but was never merged, so let's discuss it again. In u3a_pile_prep we align the stack and store both stack offsets before and after the alignment. In u3a_pile_done we compare cap_p with the post-alignment value, and if the stack is empty we restore it to the post-alignment value. Alignment is assumed to be a power of two, and the input alignment is in bytes, just like the length.

In unix.c ubsan complained that we increment a null pointer, which is supposed to be illegal? I refactored it slightly so that we formally increment it only if it is not null.

In mars.c the function pointer type and the actual function were technically incompatible.

The rest is 1 << X type fixes.

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