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

Fix ptrcalls to static GDExtension methods #91153

Merged

Conversation

dsnopek
Copy link
Contributor

@dsnopek dsnopek commented Apr 25, 2024

This was noticed during a short discussion on RocketChat.

GDScript is apparently never making any validated calls to static methods, which has meant that this bug hasn't been triggered up until now.

However, if anything were to make a validated call or ptrcall to a static GDExtension method it would have segfaulted.

This PR should fix that!

@dsnopek dsnopek added bug topic:gdextension crash cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release labels Apr 25, 2024
@dsnopek dsnopek added this to the 4.x milestone Apr 25, 2024
@dsnopek dsnopek requested review from Bromeon and vnen April 25, 2024 12:41
@dsnopek dsnopek requested a review from a team as a code owner April 25, 2024 12:41
@akien-mga akien-mga modified the milestones: 4.x, 4.3 Apr 25, 2024
@dsnopek dsnopek force-pushed the fix-gdextension-static-ptrcall branch from fd1d6b5 to 45463f7 Compare April 25, 2024 13:20
@dsnopek
Copy link
Contributor Author

dsnopek commented Apr 25, 2024

After thinking about this code for a little bit, I decided to sneak one tiny additional thing in here. It was sort of silly that validated_call() was calling into ptrcall(), which has just one line of functional code, aside from the ERR_*() macros and getting the extension instance, all of which we've already done in validated_call(). So, I copied that one line up into validated_call() itself. This will likely be a very minor performance improvement.

@akien-mga akien-mga merged commit 11d3768 into godotengine:master Apr 25, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@dsnopek dsnopek deleted the fix-gdextension-static-ptrcall branch July 22, 2024 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release crash topic:gdextension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants