From acdcb75f12b4d08fd6c16404fb113af5e29bd197 Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Sun, 2 Nov 2014 02:03:11 +0300 Subject: [PATCH] Lower the limit of bytes in allocate-vector. All the allocation routines in gencgc.c expect signed words, lower the limit by 1 bit. The size is also double word aligned, which is done with addition and masking, make sure that the addition doesn't overflow. --- src/compiler/generic/vm-fndb.lisp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/compiler/generic/vm-fndb.lisp b/src/compiler/generic/vm-fndb.lisp index 7dd3b5439..3faa13b5b 100644 --- a/src/compiler/generic/vm-fndb.lisp +++ b/src/compiler/generic/vm-fndb.lisp @@ -196,8 +196,15 @@ ;; The number of words is later converted ;; to bytes, make sure it fits. (and index - (unsigned-byte #.(- sb!vm:n-word-bits - sb!vm:word-shift)))) + (mod #.(- (expt 2 + (- sb!vm:n-word-bits + sb!vm:word-shift + ;; all the allocation routines expect a signed word + 1)) + ;; The size is double-word aligned, which is done by adding + ;; (1- (/ sb-vm:n-word-bits 2)) and then masking. + ;; Make sure addition doesn't overflow. + 3)))) (simple-array * (*)) (flushable movable)) -- 2.11.4.GIT