diff --git a/src/fontations/lib.rs b/src/fontations/lib.rs index e3b4c240f..9753a0e5f 100644 --- a/src/fontations/lib.rs +++ b/src/fontations/lib.rs @@ -28,18 +28,22 @@ struct MyAllocator; unsafe impl GlobalAlloc for MyAllocator { unsafe fn alloc(&self, layout: Layout) -> *mut u8 { + assert!(layout.align() <= 16); hb_malloc(layout.size()) as *mut u8 } unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 { + assert!(layout.align() <= 16); hb_calloc(layout.size(), 1) as *mut u8 } - unsafe fn realloc(&self, ptr: *mut u8, _layout: Layout, new_size: usize) -> *mut u8 { + unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 { + assert!(layout.align() <= 16); hb_realloc(ptr as *mut c_void, new_size) as *mut u8 } - unsafe fn dealloc(&self, ptr: *mut u8, _layout: Layout) { + unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { + assert!(layout.align() <= 16); hb_free(ptr as *mut c_void); } }