[CONC-459] Prepared statement insertion of a NULL MYSQL_TYPE_NEWDECIMAL type fails if buffer length is not set to 0 Created: 2020-03-06 Updated: 2020-03-11 Resolved: 2020-03-07 |
|
| Status: | Closed |
| Project: | MariaDB Connector/C |
| Component/s: | None |
| Affects Version/s: | 3.1.7 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Minor |
| Reporter: | David Ritter | Assignee: | Georg Richter |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I have discovered that if I attempt to send a NULL value into a column that is bound as a MYSQL_TYPE_NEWDECIMAL I receive an MySQL client run out of memory from the client. Here is my test case:
Without setting the buffer length I see this error:
It seems like a bug that if NULL is being sent that the buffer length should be used at all. |
| Comments |
| Comment by Georg Richter [ 2020-03-07 ] | |||||||||||
|
Your example code is buggy:
| |||||||||||
| Comment by David Ritter [ 2020-03-11 ] | |||||||||||
|
It doesn't make sense to me to change the buffer_type to MYSQL_TYPE_NULL if you are performing column wise binding. It seems like you would always want the C type to be the MYSQL_TYPE_<...> of the column type. I have updated my testcase accordingly:
And I still see the client of memory error. Fundamentally though because a numeric value is being inserted I do not understand why the length data member of the MYSQL_BIND struct is being used. buffer.length is defined to be used for character or binary C data length. Should we consider MYSQL_TYPE_NEWDECIMAL binary data? |