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

Fixed UBSan runtime error: calling function through pointer to incorrect type #1436

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

jspohr
Copy link
Contributor

@jspohr jspohr commented Nov 13, 2024

UBSan error was:

call to function void flecs::::free_obj<flecs::::each_delegate<>> through pointer to incorrect function type 'void (*)(void *)'

It's caused by reinterpret_casting the free_obj template to ecs_ctx_free_t and then calling it through that function type. Changing the free_obj signature fixes it. However, I don't know if you're planning on checking UBSan, so this might not be something you care about. IMHO it improves readability to get rid of the reinterpret_casts, even though you lose type safety when calling free_obj directly.

call to function void flecs::_::free_obj<flecs::_::each_delegate<>> through pointer to incorrect function type 'void (*)(void *)'
@SanderMertens
Copy link
Owner

LGTM, thanks for the PR!

@SanderMertens SanderMertens merged commit b953fd4 into SanderMertens:master Nov 15, 2024
72 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.

2 participants