Skip to content

Commit cd96988

Browse files
committed
Don't crash when local variables are too big to store on the stack
1 parent 5fcedf6 commit cd96988

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/value_and_place.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,12 @@ impl<'tcx> CPlace<'tcx> {
324324
};
325325
}
326326

327+
if layout.size.bytes() >= u64::from(u32::MAX - 16) {
328+
fx.tcx
329+
.sess
330+
.fatal(&format!("values of type {} are too big to store on the stack", layout.ty));
331+
}
332+
327333
let stack_slot = fx.bcx.create_stack_slot(StackSlotData {
328334
kind: StackSlotKind::ExplicitSlot,
329335
// FIXME Don't force the size to a multiple of 16 bytes once Cranelift gets a way to

0 commit comments

Comments
 (0)