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

Type mismatch for struct parameters crashes on Windows #98

Open
aubade opened this issue Feb 5, 2016 · 0 comments
Open

Type mismatch for struct parameters crashes on Windows #98

aubade opened this issue Feb 5, 2016 · 0 comments

Comments

@aubade
Copy link
Contributor

aubade commented Feb 5, 2016

I'm not sure exactly what's going on behind the scenes, but on Windows, when a D method wrapped in lua expects a struct parameters and has a type mismatch, it causes an assertion failure by changing the stack, and the throwing of this assertion failure spirals out of control and causes a stack overflow.

I haven't been able to get it to do this on Linux, but with DMD 2.070 on Windows 7, I've been able to trigger this with both phobos' default and m32mscoff runtimes. I've also reproduced it with both the included static lua5.1.lib and a custom build of lua 5.1.5.

Here's some example code that causes the problem

import luad.all;
import std.stdio;

struct A {
    int b;
}

void makeassertfail(A value) {
}

void main() {
    auto lua = new LuaState();
    lua.openLibs();
    lua.globals["makeassertfail"] = &makeassertfail;
    lua.doString(`
        print("Testing type mismatch.")
        makeassertfail(0);
    `);
}
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