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

The flecs cpp API invokes ub in flecs::opaque #1417

Open
Gaspard-- opened this issue Oct 30, 2024 · 0 comments
Open

The flecs cpp API invokes ub in flecs::opaque #1417

Gaspard-- opened this issue Oct 30, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Gaspard--
Copy link
Contributor

Flecs is invoking undefined behaviour by casting function pointers with reinterpret_cast in many functions of flecs::opaque and then calling them with the wrong signature:

opaque& serialize(flecs::serialize<T> func) {
this->desc.type.serialize =
reinterpret_cast<decltype(
this->desc.type.serialize)>(func);
return *this;
}

Caught using -fsanitize=undefined under clang.
The fix seems more complicated than #1416 because we need to somehow pass a function pointer that would call the other function pointer, or find some other trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant