When popping from a darray by index there is an issue when moving the data.
// If not on the last element, snip out the entry and copy the rest inward.
if (index != length - 1) {
kcopy_memory(
(void*)(addr + (index * stride)),
(void*)(addr + ((index + 1) * stride)),
stride * (length - (index - 1)));
}
The size of stride * (length - (index - 1)) will be too large, the correct value should be stride * (length - (index + 1)).
This has the potential to lead to memory corruption if not fixed.
When popping from a darray by index there is an issue when moving the data.
The size of
stride * (length - (index - 1))
will be too large, the correct value should bestride * (length - (index + 1))
. This has the potential to lead to memory corruption if not fixed.