From 626f489031fed0a2837a8aecda8d71878d0d2c80 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 20 Jun 2020 23:49:59 +0000 Subject: [PATCH] matrix-reader: Fix possibly-zero second argument to xcalloc(). xcalloc() is documented to disallow zero for its second argument: /* Allocate zeroed memory for N elements of S bytes, with error checking. S must be nonzero. */ void * xcalloc (size_t n, size_t s) This code didn't always call it properly. Found with AFL++. Thanks to Andrea Fioraldi for reporting the problem. Bug #58600. --- src/language/data-io/matrix-reader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/language/data-io/matrix-reader.c b/src/language/data-io/matrix-reader.c index 1dfe638882..6e73962a6a 100644 --- a/src/language/data-io/matrix-reader.c +++ b/src/language/data-io/matrix-reader.c @@ -138,7 +138,7 @@ create_matrix_reader_from_case_reader (const struct dictionary *dict, struct cas if (vars) { int i; - *vars = xcalloc (sizeof (struct variable **), *n_vars); + *vars = xcalloc (*n_vars, sizeof (struct variable **)); for (i = 0; i < *n_vars; ++i) { -- 2.30.2