Skip to content

Fix stack smashing when Godot methods return char32_t, char16_t or wchar_t #1753

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

Merged
merged 1 commit into from
Apr 1, 2025

Conversation

dsnopek
Copy link
Collaborator

@dsnopek dsnopek commented Mar 28, 2025

Fixes #1741

It looks like we were incorrectly encoding return values for functions that return char32_t, char16_t and wchar_t as pointers to those exact types, whereas Godot is encoding them as pointers to int64_t

This PR fixes that!

In a follow up, we should update both SCons and cmake to use the -fstack-protector-strong flag with GCC and the equivalent flag for all other compilers (at least in debug builds), so that we can catch these sort of issues quicker.

@dsnopek dsnopek added bug This has been identified as a bug crash cherrypick:4.4 labels Mar 28, 2025
@dsnopek dsnopek added this to the 4.x milestone Mar 28, 2025
@dsnopek dsnopek requested a review from a team as a code owner March 28, 2025 12:49
Copy link
Collaborator

@enetheru enetheru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested and it didnt exhibit the crash on my end, with windows 11, msvc.

@dsnopek dsnopek merged commit f3deed0 into godotengine:master Apr 1, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This has been identified as a bug cherrypick:4.3 cherrypick:4.4 crash
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CMake: Tests crashing on Linux with "stack smashing detected"
2 participants