changeset 17823:eaf5c3ef3e8d

avoid crash in sparse constructor (bug #) * Sparse.cc (Sparse<T>::Sparse (octave_idx_type, octave_idx_type, T)): Use safe_numel instead of computing nr * nc directly.
author John W. Eaton <jwe@octave.org>
date Fri, 01 Nov 2013 12:20:18 -0400
parents ebb3ef964372
children 86e8dbccf7c7
files liboctave/array/Sparse.cc
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/array/Sparse.cc	Thu Oct 31 22:19:07 2013 -0700
+++ b/liboctave/array/Sparse.cc	Fri Nov 01 12:20:18 2013 -0400
@@ -205,7 +205,7 @@
 {
   if (val != T ())
     {
-      rep = new typename Sparse<T>::SparseRep (nr, nc, nr*nc);
+      rep = new typename Sparse<T>::SparseRep (nr, nc, dimensions.safe_numel ());
 
       octave_idx_type ii = 0;
       xcidx (0) = 0;