pool: assert that the pointer for 'index' is within our allocation

This commit is contained in:
Danny Robson 2019-08-14 13:53:06 +10:00
parent 4608d24027
commit 425e933f62

View File

@ -225,6 +225,12 @@ namespace cruft {
///////////////////////////////////////////////////////////////////////
size_t index (T const *ptr) const
{
CHECK_LIMIT (
ptr,
reinterpret_cast<T*> (m_store),
reinterpret_cast<T*> (m_store) + capacity ()
);
return ptr - reinterpret_cast<T*> (m_store);
}