bugGNU Octave - Bugs: bug #51198, Computing the inverse of a...

 
 

bug #51198: Computing the inverse of a pathological matrix crashes Octave

Submitted by:  Johannes Pfeifer <jpfeifer>
Submitted on:  Wed 07 Jun 2017 02:51:00 PM UTC  
 
Category: LibrariesSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Segfault, Bus Error, etc.
Status: FixedAssigned to: None
Originator Name: Johannes PfeiferOpen/Closed: Closed
Release: 4.2.1Operating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Thu 08 Jun 2017 08:14:18 PM UTC, comment #7:

I applied your patch here (http://hg.savannah.gnu.org/hgweb/octave/rev/286d85b43bdc). In addition, I made the same change in fCMatrix.cc so that complex single matrices would not segfault in the same way. Fixed, closing report.

Rik <rik5>
Project Administrator
Thu 08 Jun 2017 08:16:27 AM UTC, comment #6:

Indeed, since the problem comes from uninitialized values, the result can be a crash or an infinite loop, depending on the values already in memory.

@Rik: what about my patch?

Sébastien Villemot <svillemot>
Wed 07 Jun 2017 07:47:45 PM UTC, comment #5:

Confirmed. On the development branch the behavior is slightly different in that Octave appears to enter an infinite loop. Either way, not good.

Rik <rik5>
Project Administrator
Wed 07 Jun 2017 03:35:38 PM UTC, comment #4:

Actually the crash happens when computing the inverse of any complex matrix containing a NaN. A minimal testcase is:

The problem lies in ComplexMatrix::finverse (MatrixType &, octave_idx_type&, double&, bool, bool) where, on the second invocation of zgetri, the pivot vector pipvt is not initialized.

I attach a patch that seems to fix the issue.

(file #40875)

Sébastien Villemot <svillemot>
Wed 07 Jun 2017 03:24:46 PM UTC, comment #3:

also using pinv instead of inv seems to work fine (?):

ans =

NaN + NaNi NaN + NaNi
NaN + NaNi NaN + NaNi

(at least no crash)

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Wed 07 Jun 2017 03:22:09 PM UTC, comment #2:

dev version hangs with 100% CPU load (instead of crash).

Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>
Wed 07 Jun 2017 03:18:43 PM UTC, comment #1:

here is a shorter ver. that crashes.
a=[1 3;5 1]
inv(a) # ok

a=[1 3;nan nan]
inv(a) # ok

a=[1 3;nan nan*i]
inv(a) #crash sig 6

ubuntu and latest stable

Doug Stewart <dastew>
Wed 07 Jun 2017 02:51:00 PM UTC, original submission:

Running
crashes Octave on Windows (with Visual studio reporting a problem with openblas.dll)

On Linux, the crash message is

Johannes Pfeifer <jpfeifer>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #40875:  bug51198.diff added by svillemot (770B - text/x-patch)
file #40874:  fs2000_calibrated_covariance_mode.mat added by jpfeifer (696B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by svillemot (Updated the item)
  • -unavailable- added by dasergatskov (Posted a comment)
  • -unavailable- added by dastew (Posted a comment)
  • -unavailable- added by jpfeifer (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 08 Jun 2017 08:14:18 PM UTCrik5StatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Wed 07 Jun 2017 07:47:45 PM UTCrik5StatusNone=>Confirmed
    Wed 07 Jun 2017 03:35:38 PM UTCsvillemotAttached File-=>Added bug51198.diff, #40875
    Wed 07 Jun 2017 02:51:00 PM UTCjpfeiferAttached File-=>Added fs2000_calibrated_covariance_mode.mat, #40874

    Back to the top


    Powered by Savane 3.1-cleanup1