>From 7ccf047ccc521535050dbbcc075b6186b4600c22 Mon Sep 17 00:00:00 2001 From: Christian Kellermann Date: Sun, 9 Oct 2011 09:46:22 +0200 Subject: [PATCH] Use machine dependent size type for allocate_vector_2 In C_allocate_vector we check the given size argument against the C_HEADER_SIZE_MASK, which are both 64 bit on 64 bit architectures. However the actual execution in allocate_vector_2 uses an int for the size pointer. So while the check is passes in the first routine we risk an overflow in the second. This patch changes int size to C_uword so it will match the type of the inital check. --- runtime.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/runtime.c b/runtime.c index f9f8459..0fc3a9c 100644 --- a/runtime.c +++ b/runtime.c @@ -7078,14 +7078,14 @@ void C_ccall C_allocate_vector(C_word c, C_word closure, C_word k, C_word size, void allocate_vector_2(void *dummy) { - C_word mode = C_restore; - int bytes = C_unfix(C_restore); - C_word align8 = C_restore, - bvecf = C_restore, - init = C_restore; - C_word size = C_unfix(C_restore); - C_word k = C_restore, - *v0, v; + C_word mode = C_restore; + C_uword bytes = C_unfix(C_restore); + C_word align8 = C_restore, + bvecf = C_restore, + init = C_restore; + C_word size = C_unfix(C_restore); + C_word k = C_restore, + *v0, v; if(C_truep(mode)) { while((C_uword)(C_fromspace_limit - C_fromspace_top) < (bytes + stack_size)) { -- 1.7.4.1