From b42117fe0cfd0e21a69a32b610e0f1f690d79e00 Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Thu, 30 Jul 2015 10:35:00 -0700 Subject: [PATCH] Avoid undefined behaviour by allocating with align 1. The allocation APIs require that the alignment is a power-of-two; meaning 1 is the "I don't care" alignment, not 0. --- components/gfx/platform/freetype/font_context.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/gfx/platform/freetype/font_context.rs b/components/gfx/platform/freetype/font_context.rs index eeaec2a0491..887c321781d 100644 --- a/components/gfx/platform/freetype/font_context.rs +++ b/components/gfx/platform/freetype/font_context.rs @@ -25,7 +25,7 @@ struct User { } // FreeType doesn't require any particular alignment for allocations. -const FT_ALIGNMENT: usize = 0; +const FT_ALIGNMENT: usize = 1; extern fn ft_alloc(mem: FT_Memory, req_size: c_long) -> *mut c_void { unsafe {