From 3d95abc9d28983a21215c6156dd9d57374cfed53 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 17 Oct 2015 17:55:13 -0700 Subject: Fix overflow check using wrong variable. * lib.c (chk_grow_vec): It is newelems which must be compared against the no_oflow value, not bytes. --- lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib.c') diff --git a/lib.c b/lib.c index a7493ef0..7e1ad0e8 100644 --- a/lib.c +++ b/lib.c @@ -2023,7 +2023,7 @@ mem_t *chk_grow_vec(mem_t *old, size_t oldelems, size_t newelems, internal_error("elsize == 0"); if (newelems <= oldelems || - ((bytes > no_oflow || elsize > no_oflow) && bytes / elsize != newelems)) + ((newelems > no_oflow || elsize > no_oflow) && bytes / elsize != newelems)) uw_throw(error_s, lit("array size overflow")); return chk_realloc(old, bytes); -- cgit v1.2.3