From 8b7453edf2265f16ac697c55d5c1a30da5f5e5c0 Mon Sep 17 00:00:00 2001 From: Peter Limkilde Svendsen <peter.limkilde@gmail.com> Date: Sat, 2 Feb 2019 16:41:09 +0100 Subject: [PATCH] Add test of calloc with overflow --- tests/stdlib/alloc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/stdlib/alloc.c b/tests/stdlib/alloc.c index bfb867340..4875b8751 100644 --- a/tests/stdlib/alloc.c +++ b/tests/stdlib/alloc.c @@ -18,6 +18,10 @@ int main(int argc, char ** argv) { } free(ptrc); + char * ptrco = (char *)calloc(SIZE_MAX, SIZE_MAX); + printf("calloc (overflowing) %p\n", ptrco); + free(ptrco); /* clean up correctly even if overflow is not handled */ + char * ptra = (char *)memalign(256, 256); printf("memalign %p\n", ptra); for(i = 0; i < 256; i++) { -- GitLab