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 userdata nil bug #305

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

stefanfrings
Copy link
Contributor

This fix prevents a segmentation fault in case a C++ function is called from Lua and nil instead of an object of a registered class is passed as parameter.

  • The get function correctly tests if nil is on the stack and returns a null pointer.
  • The bug is located in the StackHelper where the returned pointer is always dereferenced. This is the source of the undefined behavior/segmentation fault.

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