about summary refs log tree commit diff
path: root/src/liballoc_system
diff options
context:
space:
mode:
Diffstat (limited to 'src/liballoc_system')
-rw-r--r--src/liballoc_system/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/liballoc_system/lib.rs b/src/liballoc_system/lib.rs
index 6c1e9cb0b9c..d4404e564e0 100644
--- a/src/liballoc_system/lib.rs
+++ b/src/liballoc_system/lib.rs
@@ -131,6 +131,14 @@ mod platform {
             let ptr = if layout.align() <= MIN_ALIGN && layout.align() <= layout.size() {
                 libc::malloc(layout.size()) as *mut u8
             } else {
+                #[cfg(target_os = "macos")]
+                {
+                    if layout.align() > (1 << 31) {
+                        return Err(AllocErr::Unsupported {
+                            details: "requested alignment too large"
+                        })
+                    }
+                }
                 aligned_malloc(&layout)
             };
             if !ptr.is_null() {