Merge branch 'ss/commit-squash-msg' into maint
[gitweb.git] / wrapper.c
index 29a45d2654e982dbbb3fc328e16c01713d8a7fb5..9afc1a021c224d4ff2230fffeb0e4f0882d4a99e 100644 (file)
--- a/wrapper.c
+++ b/wrapper.c
@@ -152,6 +152,9 @@ void *xcalloc(size_t nmemb, size_t size)
 {
        void *ret;
 
+       if (unsigned_mult_overflows(nmemb, size))
+               die("data too large to fit into virtual memory space");
+
        memory_limit_check(size * nmemb, 0);
        ret = calloc(nmemb, size);
        if (!ret && (!nmemb || !size))