# HG changeset patch # User John W. Eaton # Date 1437070787 14400 # Thu Jul 16 14:19:47 2015 -0400 # Node ID 783b71992794ee7a3a84984d6699e924e9df6255 # Parent 2051530b9cc2fa75b851e4edbf4259f90c9efab5 fix incompatibility in mxCreateNumericArray (bug #45319) * mex.cc (mxArray_matlab::mxArray_matlab): Create empty array if dims_arg is NULL. If dims_arg is given but ndims_arg < 2, initialize dims to [1, 1]. diff --git a/libinterp/corefcn/mex.cc b/libinterp/corefcn/mex.cc --- a/libinterp/corefcn/mex.cc +++ b/libinterp/corefcn/mex.cc @@ -615,11 +615,16 @@ protected: ndims (ndims_arg < 2 ? 2 : ndims_arg), dims (static_cast (mxArray::malloc (ndims * sizeof (mwSize)))) { - if (ndims_arg < 2) + if (! dims_arg) { dims[0] = 0; dims[1] = 0; } + else if (ndims_arg < 2) + { + dims[0] = 1; + dims[1] = 1; + } for (mwIndex i = 0; i < ndims_arg; i++) dims[i] = dims_arg[i];