Opened 4 years ago

Last modified 4 years ago

#4525 new defect

Cassandra: the code in CqlLeaseMgr uses unsafe static_cast

Reported by: tomek Owned by:
Priority: medium Milestone: Outstanding Tasks
Component: database-all Version: git
Keywords: cassandra Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: N/A
Sub-Project: DHCP Feature Depending on Ticket:
Estimated Difficulty: 0 Add Hours to Ticket: 0
Total Hours: 0 Internal?: no


As part of the github pull request #21 we have accepted code for Cassandra support. It is working, but there are number of areas that has to be improved.

This ticket is about handling data. The code handles specific data types in methods like CqlLeaseMgr::addLease() method. This method calls CqlDataArray?.add method, which takes void * parameter and will store any type of data. The information of the type of this data is lost.

Further down the code, methods call CqlLeaseMgr::bindData, which in turn uses CqlFunctions? that is an array of functions that take void* parameter. Those functions do static_cast of void* to specific types. That decision is based not on the actual data type, but on the type specified for said column.

This code would happily add bool data when vector<uint8_t> is expected, and then crash when bool pointer is statically cast to vector and methods are called on it.

This is non-critical, but it should be addressed relatively soon.


Change History (2)

comment:1 Changed 4 years ago by tomek

  • Keywords cassandra added

comment:2 Changed 4 years ago by hschempf

  • Milestone changed from Kea-proposed to Outstanding Tasks

Per June 23 team meeting, move to Outstanding. Tomek will communicate w/ DT (Razvan) to explain that this ticket was created, and say that we've opted not to work on it until after 1.1.

Note: See TracTickets for help on using tickets.