Koka / odbc-rs

Rust ODBC FFI binding
MIT License
98 stars 31 forks source link

Possible UB can be caused by resize of param_ind_buffers #97

Closed jpastuszek closed 5 years ago

jpastuszek commented 5 years ago

https://github.com/Koka/odbc-rs/blob/d36276ac16e99a0404bed4bd74f918eb68b56393/src/statement/input.rs#L45

If I am not mistaken this resize call may deallocate and allocate new memory invalidating pointers passed to ffi::SQLBindParameter. Pointers passed to this functions must be valid until SQLExecute is called.

Note that I did not trigger any crash yet with this so I may be wrong here.

See this discussion: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/a5e8b15e-c47e-479e-8bde-d6e493eea977/how-to-insert-a-null-in-a-sqltypetimestamp-column-?forum=sqldataaccess

Koka commented 5 years ago

Hopefully fixed by #100