Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
avoid undefined clz and shift in edge cases
This is triggered when get_large_size_class is called with a size in the range [1,4]. This can occur with aligned_alloc(8192, size). In practice, it doesn't appear to cause any harm, but we shouldn't have any undefined behavior for well-defined usage of the API. It also occurs if the caller passes a pointer outside the slab region to free_sized but the expected size is in the range [1,4]. That usage of free_sized is already going to be considered undefined, but we should avoid undefined behavior in the caller from triggering more undefined behavior when it's avoidable.
- Loading branch information