lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Tue, Sep 20, 2016 at 2:42 PM, Christian N. <> wrote:

> I thought of setjmp/longjmp too but the setjmp (pcall) and longjmp (error) both happen in the same Lua DLL.

That does not matter. The problem in question is Lua built for runtime A but is executed with runtime B. In runtime A, the size of jmp_buf is a; in runtime B the size is b, and it may be possible that a != b. Then, if a < b, runtime B's setjmp called by Lua will cause a buffer overrun, or, if a > b, runtime B's longjmp will not restore some of the state required by Lua compiled for runtime A.

Secondly, setjmp, being a macro in either A or B or both, may do something not compatible with the other runtime's longjmp even if a == b.