Description
In mock/MockRedisAdapter.hpp:62-64 and 93-95, the list mock functions use data.size_bytes() for the allocation count but allocate elements of type T:
int dataSize = data.size_bytes(); // size in BYTES
new T[dataSize], // allocates dataSize ELEMENTS (each sizeof(T) bytes)
This allocates sizeof(T) * size_bytes() total bytes instead of the intended amount.
Additionally, std::vector<T> does not have a .size_bytes() method (line 93), so the vector overload likely won't compile for most types.
Severity
Critical
Suggested Fix
Use data.size() instead of data.size_bytes() for the allocation count.
Description
In
mock/MockRedisAdapter.hpp:62-64and93-95, the list mock functions usedata.size_bytes()for the allocation count but allocate elements of typeT:This allocates
sizeof(T) * size_bytes()total bytes instead of the intended amount.Additionally,
std::vector<T>does not have a.size_bytes()method (line 93), so the vector overload likely won't compile for most types.Severity
Critical
Suggested Fix
Use
data.size()instead ofdata.size_bytes()for the allocation count.