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

Infinite recursion on gsub #5

Open
sgstair opened this issue Nov 12, 2017 · 0 comments
Open

Infinite recursion on gsub #5

sgstair opened this issue Nov 12, 2017 · 0 comments

Comments

@sgstair
Copy link

sgstair commented Nov 12, 2017

Easy repro:
LuaRuntime.Run("var = 'test_string'; print(var:gsub('_','-'));");

Something in the error handling then recurses infinitely until it throws an IndexOutOfRange exception probably related to stack handling problems:

   at SharpLua.Lua.getline(Proto f, Int32 pc)
   at SharpLua.Lua.currentline(LuaState L, CallInfo ci)
   at SharpLua.Lua.addinfo(LuaState L, CharPtr msg)
   at SharpLua.Lua.luaG_runerror(LuaState L, CharPtr fmt, Object[] argp)
   at SharpLua.Lua.luaD_call(LuaState L, lua_TValue func, Int32 nResults)
   at SharpLua.Lua.callTMres(LuaState L, lua_TValue res, lua_TValue f, lua_TValue p1, lua_TValue p2)
   at SharpLua.Lua.luaV_gettable(LuaState L, lua_TValue t, lua_TValue key, lua_TValue val)
   at SharpLua.Lua.luaV_execute(LuaState L, Int32 nexeccalls)
   at SharpLua.Lua.luaD_call(LuaState L, lua_TValue func, Int32 nResults)
   at SharpLua.Lua.f_call(LuaState L, Object ud)
   at SharpLua.Lua.luaD_rawrunprotected(LuaState L, Pfunc f, Object ud)
   at SharpLua.Lua.luaD_pcall(LuaState L, Pfunc func, Object u, Int32 old_top, Int32 ef)
   at SharpLua.Lua.lua_pcall(LuaState L, Int32 nargs, Int32 nresults, Int32 errfunc)
   at SharpLua.Lua.luaB_pcall(LuaState L)
   at SharpLua.Lua.luaD_precall(LuaState L, lua_TValue func, Int32 nresults)
   at SharpLua.Lua.luaV_execute(LuaState L, Int32 nexeccalls)
   at SharpLua.Lua.luaD_call(LuaState L, lua_TValue func, Int32 nResults)
   at SharpLua.Lua.callTMres(LuaState L, lua_TValue res, lua_TValue f, lua_TValue p1, lua_TValue p2)
   at SharpLua.Lua.luaV_gettable(LuaState L, lua_TValue t, lua_TValue key, lua_TValue val)
   at SharpLua.Lua.luaV_execute(LuaState L, Int32 nexeccalls)
   at SharpLua.Lua.luaD_call(LuaState L, lua_TValue func, Int32 nResults)
   at SharpLua.Lua.f_call(LuaState L, Object ud)
   at SharpLua.Lua.luaD_rawrunprotected(LuaState L, Pfunc f, Object ud)
   at SharpLua.Lua.luaD_pcall(LuaState L, Pfunc func, Object u, Int32 old_top, Int32 ef)
   at SharpLua.Lua.lua_pcall(LuaState L, Int32 nargs, Int32 nresults, Int32 errfunc)
...

I've been digging around trying to figure out why, but I don't have any answers yet. I suspect there are two bugs - one in error handling, and one related to gsub with string arguments (which is what led me down this path).

@sgstair sgstair changed the title Infinite recursion on error Infinite recursion on gsub Nov 12, 2017
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