Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lua-sql-odbc Aborted on con:execute(sql) #135

Closed
wmasilva opened this issue Jan 5, 2022 · 3 comments
Closed

lua-sql-odbc Aborted on con:execute(sql) #135

wmasilva opened this issue Jan 5, 2022 · 3 comments

Comments

@wmasilva
Copy link

wmasilva commented Jan 5, 2022

I'm using debian buster, lua version 5.2.4, the lua-sql version in debian buster 2.3.1 is ok.

But recently update luasql to version 2.6.0 and got error when executing.
I download and compile the tag versions, since version 2.5.0 it fails the last version that is ok is version v2.4.0

my test script:

sourcename = "localhost_tel_app"
print("TEST LUA SQL ODBC " ..  sourcename)
local driver = require "luasql.odbc";
local env = driver.odbc();
local con, errormsg = env:connect(sourcename);
if (con == nil) then
	env:close();
	pinrt("ERROR fail connect connection: '".. sourcename .."', " .. errormsg .. "");
	return 
end
sql = "insert into testTable (timestamp, accountName) values (".. os.time() .. ", 'test')"
local res,errormsg = con:execute(sql);
if (res == nil) then
	print("ERROR fail to exec, connection: '".. sourcename .."', sql '".. sql .. "', error: '".. errormsg .."'");
	con:close()
	env:close()
	return
end
print("SUCCESS")
con:close()
env:close()

Running the script:

lua test-lua-sql-odbc.lua 
TEST LUA SQL ODBC localhost_tel_app
*** stack smashing detected ***: <unknown> terminated
Aborted (core dumped)

From the core dump:

Core was generated by `lua test-lua-sql-odbc.lua'.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007f316f1a0535 in __GI_abort () at abort.c:79
#2  0x00007f316f1f7508 in __libc_message (action=<optimized out>, fmt=fmt@entry=0x7f316f30207b "*** %s ***: %s terminated\n") at ../sysdeps/posix/libc_fatal.c:181
#3  0x00007f316f28880d in __GI___fortify_fail_abort (need_backtrace=need_backtrace@entry=false, msg=msg@entry=0x7f316f302059 "stack smashing detected") at fortify_fail.c:28
#4  0x00007f316f2887c2 in __stack_chk_fail () at stack_chk_fail.c:29
#5  0x00007f316f72ad26 in raw_execute (L=L@entry=0x55782981c260, istmt=istmt@entry=3) at src/ls_odbc.c:590
#6  0x00007f316f72b868 in conn_execute (L=0x55782981c260) at src/ls_odbc.c:977
#7  0x000055782920af95 in ?? ()
#8  0x0000557829215725 in ?? ()
#9  0x000055782920b2be in ?? ()
#10 0x000055782920a8ef in ?? ()
#11 0x000055782920b521 in ?? ()
#12 0x0000557829208ef1 in lua_pcallk ()
#13 0x0000557829206b26 in ?? ()
#14 0x0000557829207760 in ?? ()
#15 0x000055782920af95 in ?? ()
#16 0x000055782920b2b2 in ?? ()
#17 0x000055782920a8ef in ?? ()
#18 0x000055782920b521 in ?? ()
#19 0x0000557829208ef1 in lua_pcallk ()
#20 0x000055782920689b in ?? ()
#21 0x00007f316f1a209b in __libc_start_main (main=0x557829206840, argc=2, argv=0x7ffc49bab6b8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffc49bab6a8) at ../csu/libc-start.c:308
#22 0x000055782920695a in ?? ()
@tomasguisasola
Copy link
Contributor

Since you tried some different versions of the code, I think you should start by checking whether you are running and loading the proper versions. Please, add a line like the following:
print(_VERSION, luasql._VERSION, luasql._CLIENTVERSION)

Regards,
Tomás

@wmasilva
Copy link
Author

I've added the line:

print(_VERSION, driver._VERSION, driver._CLIENTVERSION)

The output now:

TEST LUA SQL ODBC localhost_tel_app
Lua 5.2	LuaSQL 2.6.0 (for Lua 5.2)	nil
*** stack smashing detected ***: terminated
Aborted (core dumped)

i've also test to execute with different lua versions:

Lua 5.1

TEST LUA SQL ODBC localhost_tel_app
Lua 5.1	LuaSQL 2.6.0 (for Lua 5.1)	nil
*** stack smashing detected ***: terminated
Aborted (core dumped)

Lua 5.3

TEST LUA SQL ODBC localhost_tel_app
Lua 5.3	LuaSQL 2.6.0 (for Lua 5.3)	nil
*** stack smashing detected ***: terminated
Aborted (core dumped)

Lua 5.4

TEST LUA SQL ODBC localhost_tel_app
Lua 5.4	LuaSQL 2.6.0 (for Lua 5.4)	nil
*** stack smashing detected ***: terminated
Aborted (core dumped)

if is relevant, I'm using unixodbc version 2.3.11.
Tag version v2.4.0 (don't know why it prints LuaSQL 2.3.5!!) it works ok.

TEST LUA SQL ODBC localhost_tel_app
Lua 5.2	LuaSQL 2.3.5 (for Lua 5.2)	nil
SUCCESS 

Regards.

@wmasilva
Copy link
Author

Just test with master version and its ok. issue is only present when downloading the tag version.

TEST LUA SQL ODBC localhost_tel_app
Lua 5.2	LuaSQL 2.6.0 (for Lua 5.2)	nil
SUCCESS

Closing the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants