Skip to content

Fix crash when require is called from root VM stack#1788

Merged
vrn-sn merged 1 commit intomasterfrom
port-over-mluau-require-fix
Apr 28, 2025
Merged

Fix crash when require is called from root VM stack#1788
vrn-sn merged 1 commit intomasterfrom
port-over-mluau-require-fix

Conversation

@vrn-sn
Copy link
Member

@vrn-sn vrn-sn commented Apr 25, 2025

Copied from #1785:

If require is called from the root interpreter stack (e.g. using C API) then lua_getinfo call will not succeed, leaving garbage in lua_Debug ar struct.
Accessing later ar.source as null-terminated string is unsafe and can cause a crash.

This PR adds a check to ensure that lua_getinfo call is successful.

@vrn-sn vrn-sn merged commit d9aa88e into master Apr 28, 2025
8 checks passed
@vrn-sn vrn-sn deleted the port-over-mluau-require-fix branch April 28, 2025 18:15
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.

3 participants