[CONC-590] c-connector bind / execute mess up memory allocation Created: 2022-05-14 Updated: 2022-05-20 |
|
| Status: | Open |
| Project: | MariaDB Connector/C |
| Component/s: | Prepared Statements |
| Affects Version/s: | 3.0.2 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Juerg Oehler | Assignee: | Georg Richter |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | crash | ||
| Environment: |
archlinux kernel 5.2.13 |
||
| Attachments: |
|
| Description |
|
i'm using mariadb c-connector with prepare, bind and execute. it works usualy. but one case end up in "corrupted unsorted chunks" and core dumping when freeing bind buffer. i suggest the whole malloc organisation is messed up after calling mysql_stmt_execute(). my test's MysqlDynamic.c show:
for more detailed explanation please see link stackoverflow. please verify code MysqlDynamic.c and compile it. i especialy wrote for debugging purposes after running randomly into troubles. please let me know if <MysqlDynamic -i> run without problems. thank you |
| Comments |
| Comment by Georg Richter [ 2022-05-14 ] | |
|
Please provide a short reproducible test case, but not 645 lines of code (where most of the code is unrelated to your problem). | |
| Comment by Ralf Gebhardt [ 2022-05-16 ] | |
|
Hi SwissGeorge, I am changing the priority until we got a reproducible test case. | |
| Comment by Sergei Golubchik [ 2022-05-16 ] | |
|
why are you doing
? Can you point to the documentation where you took it from? | |
| Comment by Juerg Oehler [ 2022-05-17 ] | |
|
hi sergei goulubchik thank you for the hint. i changed my code to strlen(). now the program runs stable. 20 years ago i was using oracles, sybase and informix functionalities what they called Dynamic SQL. hence i tried to understand the way i have to use your functionalties. intention is to bind my buffer to database structure and use it by just move the pointer through the array of buffers. i went through any of your documents including Connector/C Types where i found <STMT_INDICATOR_NTS>. after reading all of the documention around bind/execute i really do not feel to have understood all the features good enough in order to write stable applications. i tried to ask for more documentations alike c-type db-type relation. this because of i do not understand why i have to declare my c buffer as <MYSQL_TYPE_VARCHAR>. c only knows char and arrays of it. the database datatype is available after mysql_stmt_prepare, i do bind them together thereafter. i was understanding there are two functions for mysql_stmt_bind; parameter for writing to the db and result for reading. to me it is obvious to use different bindings for input and output. but MYSQL_BIND in confused me as not all attributes are clear in effect to me. furthermore i discoverd implicit conversion c-string to DATE/TIME db structure. i so changed to <try and error> i try to avoid. why did i use <<STMT_INDICATOR_NTS> and wrote this issue as <need feedback>?
BTW: <STMT_INDICATOR_NTS> would reduce mysql_stmt_bind calls substantialy. please let me know for which cases <STMT_INDICATOR_NTS> is supported. if also supported for row-wise binding, i continue to provide a short testversion asked by Georg Richter. It looks like all single calls work well - recurring calls to bind/execute cause the problem. it would be great if somebody could verify and some information to the description MYSQL_BIND in . please verify <is_null Pointer which indicates if column is NULL (not used for parameters)>. my test's show a <string with length and is_null = 1> will be stored as NULL - which is great. in what cases is <length_value Used if length pointer is NULL> used (input / output / both)? | |
| Comment by Juerg Oehler [ 2022-05-20 ] | |
|
hi Georg Richter i was working on your request to extract a test case reproducing the issue. now i'm hanging in the ropes not knowing if i was missunderstanding Connector/C Types and Definitions. if so, there is no motivation to continue debugging. otherwise i'll be glad to give something back to the community. thank you for short answer. |