dolphindb / DolphinDBPlugin

Apache License 2.0
49 stars 33 forks source link

kdb+ plugin uses unsafe C++ code #14

Open FlyingOE opened 1 year ago

FlyingOE commented 1 year ago

Assigning the result of str.c_str() to a pointer to be used later is against the C++ standard and is not safe. For example: https://github.com/dolphindb/DolphinDBPlugin/blob/30535a5e76a2ccbfa9820de396313c8cf9d713b5/kdb/src/kdb.cpp#L61

FlyingOE commented 1 year ago

There is also potential memory leak upon initial qIPC call in kdb::loadTable:

https://github.com/dolphindb/DolphinDBPlugin/blob/6bbadf97363e410472533ad38973a4e2e2bab684/kdb/src/kdb.cpp#L95

https://github.com/dolphindb/DolphinDBPlugin/blob/6bbadf97363e410472533ad38973a4e2e2bab684/kdb/src/kdb.cpp#L108

FlyingOE commented 1 year ago

This is not exception-safe: https://github.com/dolphindb/DolphinDBPlugin/blob/6bbadf97363e410472533ad38973a4e2e2bab684/kdb/src/kdb.cpp#L1307