this example reads somehow extremely "tricky programmed".
If you look at the ASan stack trace produced by the OP you can see a reference to a folder named "lua_fuzz", and so that likely means that this code was produced by a fuzz tester, which would be a random Lua code generator intended to find bugs in programs by randomly probing the space of possible input programs until a crash is produced. Hence it is not "real" code. Despite that, these tests can sometimes flag real bugs in an interpreter, though in this case, as pointed out by cloudwu@, it appears to be a program that is not guaranteed by Lua to work to begin with, and so that means that the random Lua code generator in the OP's fuzz tester needs to be adjusted.
David