lua-users home
lua-l archive

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


Hello,

when a Lua snippet below (full version of reduced snippet is in [1]):

local d = 1
d = d *
_G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G

         <snipped>

._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G
._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G
._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G._G


is passed to test lua_load_test.cc [2] I've observe a stack overflow in getobjname reported by Address Sanitizer (full log is in [3]):


INFO: Running with entropic power schedule (0xFF, 100).
INFO: Seed: 1500452947
INFO: Loaded 1 modules   (9009 inline 8-bit counters): 9009 [0x5604e06bd470, 0x5604e06bf7a1),
INFO: Loaded 1 PC tables (9009 PCs): 9009 [0x5604e06bf7a8,0x5604e06e2ab8),
./build/tests/lua_load_test: Running 1 inputs 1 time(s) each.
Running: so.lua
AddressSanitizer:DEADLYSIGNAL
=================================================================
==892062==ERROR: AddressSanitizer: stack-overflow on address 0x7fff18fbbe88 (pc 0x5604e051e2ba bp 0x7fff18fbc0d0 sp 0x7fff18fbbe90 T0)     #0 0x5604e051e2ba in getobjname /home/sergeyb/sources/lua-c-api-tests/build/lua-master/source/ldebug.c:529:11     #1 0x5604e05201d4 in gxf /home/sergeyb/sources/lua-c-api-tests/build/lua-master/source/ldebug.c:521:5     #2 0x5604e051e992 in getobjname /home/sergeyb/sources/lua-c-api-tests/build/lua-master/source/ldebug.c:561:16

<snipped>

    #244 0x5604e051e992 in getobjname /home/sergeyb/sources/lua-c-api-tests/build/lua-master/source/ldebug.c:561:16     #245 0x5604e05201d4 in gxf /home/sergeyb/sources/lua-c-api-tests/build/lua-master/source/ldebug.c:521:5     #246 0x5604e051e992 in getobjname /home/sergeyb/sources/lua-c-api-tests/build/lua-master/source/ldebug.c:561:16

SUMMARY: AddressSanitizer: stack-overflow /home/sergeyb/sources/lua-c-api-tests/build/lua-master/source/ldebug.c:529:11 in getobjname
==892062==ABORTING


Steps to reproduce:

- git clone https://github.com/ligurio/lua-c-api-tests

- CC=clang CXX=clang++ cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DUSE_LUA=ON -DENABLE_ASAN=ON

- cmake --build build --parallel -t lua_load_test

- ./build/tests/lua_load_test testcase.lua


1. https://github.com/ligurio/snippets/blob/master/lua-so-getobjname/so-getobjname.lua

2. https://github.com/ligurio/lua-c-api-tests/blob/master/tests/lua_load_test.cc

3. https://github.com/ligurio/snippets/blob/master/lua-so-getobjname/so-getobjname.log


Sergey