Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make tests pass under -c opt #24

Merged
merged 4 commits into from
Jul 11, 2024
Merged

Make tests pass under -c opt #24

merged 4 commits into from
Jul 11, 2024

Conversation

mcy
Copy link
Owner

@mcy mcy commented Jul 11, 2024

Make everything pass with optimizations turned on. This revealed two UB bugs:

  1. best::vec<T> was manipulating size_ directly, even when this would violate strict aliasing. This caused some tests to fail because loading size_ would ignore stores made through data(), because &size_ and data() cannot alias because they have different types. size_ is now manipulated exclusively through memcpy().

  2. A UAF in fnref_test.cc (but not best::fnref itself).

Since I was already touching best::fnref, I added a small optimization when constructing a best::fnref from a no-capture lambda.

@mcy mcy merged commit 67e43b2 into main Jul 11, 2024
3 checks passed
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.

None yet

1 participant