diff --git a/src/tbbmalloc/frontend.cpp b/src/tbbmalloc/frontend.cpp index 77f9d6594e..c9aaf46337 100644 --- a/src/tbbmalloc/frontend.cpp +++ b/src/tbbmalloc/frontend.cpp @@ -817,6 +817,7 @@ unsigned int getSmallObjectIndex(unsigned int size) /* * Depending on indexRequest, for a given size return either the index into the bin * for objects of this size, or the actual size of objects in this bin. + * TODO: Change return type to unsigned short. */ template static unsigned int getIndexOrObjectSize (unsigned int size) @@ -1581,6 +1582,7 @@ void Block::initEmptyBlock(TLSData *tls, size_t size) unsigned int objSz = getObjectSize(size); cleanBlockHeader(); + MALLOC_ASSERT(objSz <= USHRT_MAX, "objSz must not be less 2^16-1"); objectSize = objSz; markOwned(tls); // bump pointer should be prepared for first allocation - thus mode it down to objectSize