From 1e1104a11ccdd807f91b43e1a43635a304272501 Mon Sep 17 00:00:00 2001 From: Matthew Parkinson Date: Thu, 17 Mar 2022 09:47:01 +0000 Subject: [PATCH] Fix 32bit external pointer. For 32bit external pointer it was performing a divide by size, and for things not managed by snmalloc this was causing a crash. This checks for zero, and gives the start of the address range as the start of the object. --- src/mem/sizeclasstable.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mem/sizeclasstable.h b/src/mem/sizeclasstable.h index 1569bc8..ae55545 100644 --- a/src/mem/sizeclasstable.h +++ b/src/mem/sizeclasstable.h @@ -357,6 +357,8 @@ namespace snmalloc } else { + if (size == 0) + return 0; return slab_start + (offset / size) * size; } }