changeset 23560:286d85b43bdc stable

Fix crash when inverting complex matrices with NaNs (bug #51198). * CMatrix.cc (CompleMatrix::finverse): Test for NaN or Inf in norm of matrix before executing zgetri. * fCMatrix.cc (FloatCompleMatrix::finverse): Test for NaN or Inf in norm of matrix before executing zgetri.
author Sébastien Villemot <sebastien@debian.org>
date Wed, 07 Jun 2017 17:32:06 +0200
parents 5faf1767f9a9
children 66dc0ce97f2b afacc2f244bb
files liboctave/array/CMatrix.cc liboctave/array/fCMatrix.cc
diffstat 2 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/array/CMatrix.cc	Thu Jun 08 08:55:41 2017 +0200
+++ b/liboctave/array/CMatrix.cc	Wed Jun 07 17:32:06 2017 +0200
@@ -873,7 +873,8 @@
         info = -1;
     }
 
-  if ((info == -1 && ! force) || octave::math::isinf (anorm))
+  if ((info == -1 && ! force)
+      || octave::math::isnan (anorm) || octave::math::isinf (anorm))
     retval = *this;  // Restore contents.
   else
     {
--- a/liboctave/array/fCMatrix.cc	Thu Jun 08 08:55:41 2017 +0200
+++ b/liboctave/array/fCMatrix.cc	Wed Jun 07 17:32:06 2017 +0200
@@ -875,7 +875,8 @@
         info = -1;
     }
 
-  if ((info == -1 && ! force) || octave::math::isinf (anorm))
+  if ((info == -1 && ! force)
+      || octave::math::isnan (anorm) || octave::math::isinf (anorm))
     retval = *this;  // Restore contents.
   else
     {