# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1343491150 14400 # Node ID 4328e28414aa7e4db247867280aad6700fbd3d24 # Parent bc61fba0e9fd948dde33317996cc924e902c0696# Parent 1316bfc6e260d92ef043110e54c60fc4f213a1fe maint: periodic merge of stable to default diff -r bc61fba0e9fd -r 4328e28414aa liboctave/sparse-dmsolve.cc --- a/liboctave/sparse-dmsolve.cc Fri Jul 27 16:31:18 2012 -0700 +++ b/liboctave/sparse-dmsolve.cc Sat Jul 28 11:59:10 2012 -0400 @@ -33,6 +33,7 @@ #include "MatrixType.h" #include "oct-sort.h" #include "oct-locbuf.h" +#include "oct-inttypes.h" template static MSparse @@ -42,9 +43,17 @@ octave_idx_type cend, octave_idx_type maxnz = -1, bool lazy = false) { - octave_idx_type nz = (rend - rst) * (cend - cst); + octave_idx_type nr = rend - rst, nc = cend - cst; maxnz = (maxnz < 0 ? A.nnz () : maxnz); - MSparse B (rend - rst, cend - cst, (nz < maxnz ? nz : maxnz)); + octave_idx_type nz; + + // Cast to uint64 to handle overflow in this multiplication + if (octave_uint64 (nr)*octave_uint64 (nc) < octave_uint64 (maxnz)) + nz = nr*nc; + else + nz = maxnz; + + MSparse B (nr, nc, (nz < maxnz ? nz : maxnz)); // Some sparse functions can support lazy indexing (where elements // in the row are in no particular order), even though octave in // general can't. For those functions that can using it is a big diff -r bc61fba0e9fd -r 4328e28414aa scripts/help/unimplemented.m --- a/scripts/help/unimplemented.m Fri Jul 27 16:31:18 2012 -0700 +++ b/scripts/help/unimplemented.m Sat Jul 28 11:59:10 2012 -0400 @@ -38,7 +38,7 @@ txt = ["quad2d is not implemented. Consider using dblquad."]; case "gsvd" - txt = ["gsvd is not currently part of core Octave. See the ", + txt = ["gsvd is not currently part of core Octave. See the ",... "linear-algebra package at @url{http://octave.sf.net/linear-algebra/}."]; case "linprog"