Open
Description
When calling a lua function that errors, the C stack is not cleaned up. If the lua function is called many times, it will eventually overflow the stack. Any further calls to the error handler result in the error "error in error handling" being returned.
This is the smallest test case I could come up with to reproduce it. I'm on Linux using lua 5.1.5 and the most recent version of golua.
error.go:
package main
import "github.com/aarzilli/golua/lua"
import "fmt"
func main() {
L := lua.NewState()
L.OpenLibs()
if err := L.DoFile("error.lua"); err != nil {
panic(err)
}
// 120 worked on my machine, might be different for you
for i:=0; i<120; i++ {
top := L.GetTop()
L.GetGlobal("doError")
err := L.Call(0, lua.LUA_MULTRET)
if err != nil {
fmt.Println("error:", err)
fmt.Println("stack length:", len(L.StackTrace()))
// fmt.Println("stack:", L.StackTrace())
}
L.SetTop(top)
}
}
error.lua:
function doError()
error("something bad")
end
Metadata
Metadata
Assignees
Labels
No labels