summary refs log tree commit diff
path: root/amd64
diff options
context:
space:
mode:
Diffstat (limited to 'amd64')
-rw-r--r--amd64/isel.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/amd64/isel.c b/amd64/isel.c
index e5202cb..22e1e14 100644
--- a/amd64/isel.c
+++ b/amd64/isel.c
@@ -588,6 +588,8 @@ amd64_isel(Fn *fn)
 					err("invalid alloc size %"PRId64, sz);
 				sz = (sz + n-1) & -n;
 				sz /= 4;
+				if (sz > INT_MAX - fn->slot)
+					die("alloc too large");
 				fn->tmp[i->to.val].slot = fn->slot;
 				fn->slot += sz;
 				*i = (Ins){.op = Onop};