Skip to content
Snippets Groups Projects
Commit 988ae82c authored by Jan David Mol's avatar Jan David Mol
Browse files

Task #9522: Fix possibility of overlapping allocation in SparseSetAllocator

parent f4ba80d2
No related branches found
No related tags found
No related merge requests found
......@@ -124,6 +124,11 @@ namespace LOFAR
for (SparseSet<void *>::const_iterator it = freeList.getRanges().begin(); it != freeList.getRanges().end(); it++) {
void *begin = align(it->begin, alignment);
if ((char *) begin >= (char *) it->end ) {
// alignment shift already results in out of bounds
continue;
}
if ((char *) it->end - (char *) begin >= (ptrdiff_t) size) {
// enough space -- reserve it
freeList.exclude(begin, (void *) ((char *) begin + size));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment