~ chicken-core (chicken-5) 190a81881f0c9e8105098ce43ae660b24dbac575


commit 190a81881f0c9e8105098ce43ae660b24dbac575
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Mon Jul 20 22:52:08 2015 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Mon Jul 20 22:52:08 2015 +0200

    C_allocate_vector: better range-check (negative sizes)

diff --git a/runtime.c b/runtime.c
index 77b95aea..f5e8b86b 100644
--- a/runtime.c
+++ b/runtime.c
@@ -7161,7 +7161,7 @@ void C_ccall C_allocate_vector(C_word c, C_word *av)
   align8 = av[ 5 ];
   n = C_unfix(size);
 
-  if(n > C_HEADER_SIZE_MASK)
+  if(n > C_HEADER_SIZE_MASK || n < 0)
     barf(C_OUT_OF_RANGE_ERROR, NULL, size, C_fix(C_HEADER_SIZE_MASK));
 
   if(!C_truep(bvecf)) bytes = C_wordstobytes(n) + sizeof(C_word);
Trap