matrix-reader: Fix possibly-zero second argument to xcalloc().
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 20 Jun 2020 23:49:59 +0000 (23:49 +0000)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 20 Jun 2020 23:49:59 +0000 (23:49 +0000)
commit626f489031fed0a2837a8aecda8d71878d0d2c80
tree06bb5361b2f626d82d6d8e761bce093b6952035a
parent15ef05d85e50f0e5f30dfbd90458f7e54a203206
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