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

Prevent overflow in lua_newuserdatadtor #639

Merged
merged 1 commit into from
Aug 16, 2022

Conversation

XmiliaH
Copy link
Contributor

@XmiliaH XmiliaH commented Aug 16, 2022

In case a large userdata size is passed to lua_newuserdatadtor it might overflow the size resulting in luaU_newudata actually allocating the object without a memory error. This will then result in overwriting part of the metatable pointer of the userdata.

This PR fixes this issue by checking for the overflow and in such cases pass a size value which will cause a memory error in luaU_newudata.

Copy link
Collaborator

@zeux zeux left a comment

Choose a reason for hiding this comment

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

size should probably have been int given that we don't support userdata above that anyway... ah well. Thanks!

@zeux zeux merged commit 4ded555 into luau-lang:master Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants