From a13e30ce7d39e39f76ff45405c412910e18bab25 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Mon, 30 Dec 2013 09:42:12 +0900 Subject: [PATCH] Checking for negative values in make-vector. --- vm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vm.c b/vm.c index ba14ced4..f5925474 100644 --- a/vm.c +++ b/vm.c @@ -1456,6 +1456,8 @@ sexp sexp_apply (sexp ctx, sexp proc, sexp args) { sexp_context_top(ctx) = top; if (! sexp_fixnump(_ARG1)) sexp_raise("make-vector: not an integer", sexp_list1(ctx, _ARG1)); + if (sexp_unbox_fixnum(_ARG1) < 0) + sexp_raise("make-vector: length must be non-negative", sexp_list1(ctx, _ARG1)); _ARG2 = sexp_make_vector(ctx, _ARG1, _ARG2); top--; break;