DolphinDBPlugin icon indicating copy to clipboard operation
DolphinDBPlugin copied to clipboard

kdb+ plugin uses unsafe C++ code

Open FlyingOE opened this issue 2 years ago • 2 comments

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 avatar Aug 10 '23 08:08 FlyingOE

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 avatar Aug 16 '23 18:08 FlyingOE

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

FlyingOE avatar Aug 17 '23 01:08 FlyingOE