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

Linux 32bit Lua interpreter raise a segmentaion fault error #11

Open
GoogleCodeExporter opened this issue Mar 12, 2015 · 0 comments
Open

Comments

@GoogleCodeExporter
Copy link

Using JNLua interpreter version 0.9.6 from java I got a segmentation fault. 
Only under Linux 32bit.

Code to reproduce the bug:

<code>
import com.naef.jnlua.LuaState;


public class Main {

    public static void main(String[] args){
        System.out.println("Start");

        String luaSource = "local source, line = string.rep(\"a\\n\",4500), 2 "
                + "print('string find') io.flush()"
                + "string.find(source,string.rep('[^\\n]*\\n',line))"
                + "print('string find OK')io.flush()";


System.loadLibrary("lua5.1");

        LuaState state = new LuaState();
        state.openLibs();

        state.load(luaSource, "sample");
        state.call(0, 0);
        System.out.println("END");
    }

}
</code>

The expected output is : 
Start
string find
string find OK
END

but got:
Start
string find

Because the lua line "string.find(source,string.rep('[^\\n]*\\n',line))" crash 
the JVM.
It's can be due to the size of string manipulated, because when changing the 
value of the lua variable "line" to 2 instead of 4300 doesn't crash the JVM 
anymore.

See attached dll used.

Original issue reported on code.google.com by [email protected] on 13 Dec 2013 at 10:29

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant