lua-users home
lua-l archive

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




On Wed, Mar 3, 2021 at 8:17 PM Gé Weijers <ge@weijers.org> wrote:


On Wed, Mar 3, 2021 at 5:50 PM actboy168 <actboy168@gmail.com> wrote:
Open the LUAI_ASSERT macro, and then run this code, it will get an assertion failure.


I'm not seeing this on MacOS (neither x86_64 nor ARM v8), but I do see this on Debian Linux 10.8 (for x86_64)

The issue is on line 66 of ldebug.c. The bug is in the assertion, the value of 'i' in this test is -1, which makes the second test of the assertion use the index -1 for the array f->abslineinfo. I don't believe there's anything wrong with the code beyond the assertion.

I changed the assertion to:

    lua_assert(i == -1 || (i >= 0 && i < f->sizeabslineinfo && f->abslineinfo[i].pc <= pc));.

and all seems to be fine now.