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

call_lua_direct with REF_IDX incorrectly pushes argument to lua_call #32

Open
ma-bo opened this issue Jun 19, 2019 · 1 comment
Open

Comments

@ma-bo
Copy link

ma-bo commented Jun 19, 2019

For example, on line winapi.c:2080
lcb_call(parms,-1,0,REF_IDX); // pass it a new File reference

In wutils.c:119
BOOL call_lua_direct(lua_State *L, Ref ref, int idx, const char *text, int flags) {
if (flags & REF_IDX)
lua_pushvalue(L,idx);

idx == -1, but push_ref(L,ref) pushes the function to the top of the stack, making lua_pushvalue(L,idx) incorrect.

@ma-bo
Copy link
Author

ma-bo commented Jun 19, 2019

Potential solution to account for the off by one error for negative indicies: lua_pushvalue(L,idx < 0 ? --idx : idx)

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

No branches or pull requests

1 participant