Ikemen-GO
Ikemen-GO copied to clipboard
Attached chars may crash when using enemy redirection
Describe the bug
An attached character using enemy redirection can make Ikemen crash during match load.
Here's the crash log I got:
runtime error: index out of range
with length 0
goroutine 1 [running, locked to thread]:
github.com/yuin/gopher-lua.(*LState).PCall.func1()
C:/Users/runneradmin/go/pkg/mod/github.com/yuin/[email protected]/state.go:1988 +0x212
panic({0x13f586b60, 0xc004333818})
C:/hostedtoolcache/windows/go/1.20.6/x64/src/runtime/panic.go:884 +0x213
main.(*Char).enemy(0xc003c87500, 0x2)
D:/a/Ikemen-GO/Ikemen-GO/src/char.go:2785 +0x338
main.BytecodeExp.run({0xc00a934600?, 0xc6, 0x100}, 0xc003c87500)
D:/a/Ikemen-GO/Ikemen-GO/src/bytecode.go:1007 +0x741a
main.BytecodeExp.evalB({0xc00a934600?, 0xc00499e550?, 0xc00815f550?}, 0x1?)
D:/a/Ikemen-GO/Ikemen-GO/src/bytecode.go:2135 +0x1e
main.StateBlock.Run({0x1, 0xffffffff, 0xfffffffe, 0x0, {0xc00a934600, 0xc6, 0x100}, 0x0, {0xc00833a600, 0x1, ...}, ...}, ...)
D:/a/Ikemen-GO/Ikemen-GO/src/bytecode.go:2317 +0x37a
main.StateBlock.Run({0x1, 0xffffffff, 0xfffffffe, 0x0, {0x0, 0x0, 0x0}, 0x0, {0xc00390ec00, 0x3d, ...}, ...}, ...)
D:/a/Ikemen-GO/Ikemen-GO/src/bytecode.go:2331 +0x4c6
main.(*StateBytecode).run(0xc003c87650, 0x0?)
D:/a/Ikemen-GO/Ikemen-GO/src/bytecode.go:8524 +0x225
main.(*Char).changeStateEx(0xc003c87500, 0x8?, 0x8?, 0x1?, 0xffffffff, {0x0?, 0x0?})
D:/a/Ikemen-GO/Ikemen-GO/src/char.go:3456 +0x297
main.(*Char).changeState(...)
D:/a/Ikemen-GO/Ikemen-GO/src/char.go:3464
main.changeState.Run({0xc002ec45c0?, 0x0?, 0x0?}, 0x0?, {0x0?, 0x0?, 0x0?})
D:/a/Ikemen-GO/Ikemen-GO/src/bytecode.go:2705 +0xf8
main.StateBlock.Run({0x1, 0xffffffff, 0xfffffffe, 0x0, {0x0, 0x0, 0x0}, 0x0, {0xc00bf34ea0, 0x1, ...}, ...}, ...)
D:/a/Ikemen-GO/Ikemen-GO/src/bytecode.go:2331 +0x4c6
main.(*StateBytecode).run(0xc003c87650, 0xc003910ed0?)
D:/a/Ikemen-GO/Ikemen-GO/src/bytecode.go:8524 +0x225
main.(*Char).actionRun(0xc003c87500)
D:/a/Ikemen-GO/Ikemen-GO/src/char.go:5707 +0x6ff
main.(*CharList).action(0x13f50a920, 0x28c34335?, 0x433543541f02c21f?, 0x3543c73543c328c3?, 0x1f543543c328c343?, 0xc21fc243541f02c2?, 0x1f11cd02c511c315?, 0x4315111f1102c211?)
D:/a/Ikemen-GO/Ikemen-GO/src/char.go:6376 +0x10b
main.(*System).action(0x13f509be0)
D:/a/Ikemen-GO/Ikemen-GO/src/system.go:1328 +0x479
main.(*System).fight(0x13f509be0)
D:/a/Ikemen-GO/Ikemen-GO/src/system.go:2058 +0x1426
main.systemScriptInit.func57.2()
D:/a/Ikemen-GO/Ikemen-GO/src/script.go:979 +0x579
main.systemScriptInit.func57(0xc000106420)
D:/a/Ikemen-GO/Ikemen-GO/src/script.go:1024 +0x3d3
github.com/yuin/gopher-lua.callGFunction(0xc000106420, 0x0)
C:/Users/runneradmin/go/pkg/mod/github.com/yuin/[email protected]/vm.go:202 +0x37
github.com/yuin/gopher-lua.init.3.func26(0xc000106420, 0xc0c0001?, 0xc000205000?)
C:/Users/runneradmin/go/pkg/mod/github.com/yuin/[email protected]/vm.go:821 +0x379
github.com/yuin/gopher-lua.mainLoop(0xc000106420, 0xc000175740?)
C:/Users/runneradmin/go/pkg/mod/github.com/yuin/[email protected]/vm.go:31 +0xfa
github.com/yuin/gopher-lua.(*LState).callR(0xc000106420, 0x0, 0xffffffffffffffff, 0xc00000a7a8?)
C:/Users/runneradmin/go/pkg/mod/github.com/yuin/[email protected]/state.go:1211 +0x1b4
github.com/yuin/gopher-lua.(*LState).Call(...)
C:/Users/runneradmin/go/pkg/mod/github.com/yuin/[email protected]/state.go:1967
github.com/yuin/gopher-lua.(*LState).PCall(0xc000106420, 0x0, 0xc000175740?, 0x0)
C:/Users/runneradmin/go/pkg/mod/github.com/yuin/[email protected]/state.go:2030 +0x145
github.com/yuin/gopher-lua.(*LState).DoFile(0xc000106420, {0xc0000158d8?, 0x0?})
C:/Users/runneradmin/go/pkg/mod/github.com/yuin/[email protected]/auxlib.go:396 +0x6b
main.main()
D:/a/Ikemen-GO/Ikemen-GO/src/main.go:90 +0x218
stack traceback:
[G]: in function 'game'
.\external\script\start.lua:1403: in function 'f_game'
.\external\script\start.lua:1839: in function 'launchFight'
external/script/default.lua:2: in function <external/script/default.lua:0>
.\external\script\start.lua:1457: in function 'f'
external/script/main.lua:3105: in function 'loop'
external/script/main.lua:3189: in function 'loop'
external/script/main.lua:4156: in main chunk
[G]: ?
If all enemy redirections in the attached char are disabled, the crash no longer happens.
To Reproduce
Use this stage: terrymotw.zip
Start a 1 vs 3 match (curiously 3 vs 1 does not crash).
Expected behavior
No crash, of course.
Screenshots / Video
No response
Engine Version (or source code date)
25/07/2023 but also 0.98.2
Operating system
Windows