gm_tmysql4
gm_tmysql4 copied to clipboard
Odd issue with error handling
Basically when ever there is an error for tmysql its not displaying the full error for me. I'm currently using the mysql.lua file from Dash along with this version of tmysql.
As for where the error is originating, I know for a fact its in the callback function of DB:Query(), however I can't get any sort of info on where in the callback the error is happening at
The handling also majorly broken if you make syntax mistakes in SQL. It will return corrupt error messages (which can signal memory corruption), and it will probably crash your server shortly after error.
There was a difference in behavior for error messages between regular queries and prepared statements that should have been fixed in the latest commit - prepared statements weren't always returning anything useful with their error method
https://github.com/SuperiorServers/gm_tmysql4/blob/master/src/database.cpp#L182
The issue is with the use of qErr.c_str() here, which causes "use after free" for that region of memory that is passed to Lua state.
@aStonedPenguin