~ chicken-core (chicken-5) bd345df26441ab8d896c3502966a652c7365eea4


commit bd345df26441ab8d896c3502966a652c7365eea4
Author:     Peter Bex <peter@more-magic.net>
AuthorDate: Sat Aug 22 18:17:47 2015 +0200
Commit:     Peter Bex <peter@more-magic.net>
CommitDate: Sat Aug 22 19:37:27 2015 +0200

    C_allocate_vector: better range-check (negative sizes)

diff --git a/runtime.c b/runtime.c
index f213037c..878672b0 100644
--- a/runtime.c
+++ b/runtime.c
@@ -9940,7 +9940,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