Skip to content

Commit 4e91a2d

Browse files
rdevshpthestinger
authored andcommitted
add expected_size > max_slab_size_class check for h_free_sized
1 parent 0392867 commit 4e91a2d

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

h_malloc.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,6 +1748,10 @@ EXPORT void h_free_sized(void *p, size_t expected_size) {
17481748
expected_size = adjust_size_for_canary(expected_size);
17491749

17501750
if (p < get_slab_region_end() && p >= ro.slab_region_start) {
1751+
if (unlikely(expected_size > max_slab_size_class)) {
1752+
fatal_error("sized deallocation mismatch (small)");
1753+
}
1754+
17511755
thread_unseal_metadata();
17521756
expected_size = get_size_info(expected_size).size;
17531757
deallocate_small(p, &expected_size);

0 commit comments

Comments
 (0)