bugGNU Octave - Bugs: bug #37095, Segfault when calling chol () on...

 
 

bug #37095: Segfault when calling chol () on non-SPD sparse matrix and requesting a second output argument

Submitted by:  Guillaume <gyom>
Submitted on:  Tue 14 Aug 2012 03:44:54 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Crash
Status: FixedAssigned to: Jordi Gutiérrez Hermoso <jordigh>
Originator Name: GuillaumeOpen/Closed: Closed
Release: devOperating System: Any

Add a New Comment (Rich MarkupRich 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 16 Aug 2012 03:46:00 PM UTC, comment #7:

Okay, I pushed the fix:

http://hg.savannah.gnu.org/hgweb/octave/rev/82d51d6e470c

It's on the default branch, because it seems to be a relatively rare edge case and I wasn't confident enough to apply it to the stable branch. So it will see the light of day by Octave 3.8.

Jordi Gutiérrez Hermoso <jordigh>
Project AdministratorIn charge of this item.
Wed 15 Aug 2012 03:21:29 PM UTC, comment #6:

Works fine, thanks!

Guillaume <gyom>
Wed 15 Aug 2012 02:26:43 PM UTC, comment #5:

Okay, how about the revised patch?

(file #26362)

Jordi Gutiérrez Hermoso <jordigh>
Project AdministratorIn charge of this item.
Wed 15 Aug 2012 12:09:59 PM UTC, comment #4:

Many thanks for looking into this, Jordi.

The patch seems to work for me (ie no segfault and the second output argument prevents an error to be triggered) but there are still warning messages that are displayed:

They are redundant with the information given by the second output argument so they could be removed (MATLAB does not display any).

Guillaume <gyom>
Tue 14 Aug 2012 07:58:52 PM UTC, comment #3:

Okay, so the issue is that the Octave code stops computation prematurely if the cholmod library flags the matrix as not positive definite, and as part of those computations it's supposed to set the Lsparse pointer to a nonzero value. When it doesn't do that but the return values are requested anyways, it attempts to dereference a null pointer and segfaults.

My patch attached here is an attempt to test if more than output argument is requested, and to plod along even if the matrix fails to be positive definite and return whatever value cholmod thought should be returned.

If there are no complaints with this patch for a few days, I'll push it.

(file #26361)

Jordi Gutiérrez Hermoso <jordigh>
Project AdministratorIn charge of this item.
Tue 14 Aug 2012 04:27:10 PM UTC, comment #2:

This seems like an easy fix, working on it...

Jordi Gutiérrez Hermoso <jordigh>
Project AdministratorIn charge of this item.
Tue 14 Aug 2012 04:25:26 PM UTC, comment #1:

Hi I can confirm the bug on a recent build,
I changed the title to specify that the crash occurs
only if the input matrix is sparse.

Thanks for the report,
c.

Carlo de Falco <cdf>
Project Member
Tue 14 Aug 2012 03:44:54 PM UTC, original submission:

Calling CHOL on a non positive definite sparse matrix and two output arguments generates a segmentation fault:

Guillaume <gyom>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #26362:  cholmod.patch added by jordigh (5kB - text/x-diff)
file #26361:  cholmod.patch added by jordigh (4kB - text/x-diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jordigh (Posted a comment)
  • -unavailable- added by cdf (Posted a comment)
  • -unavailable- added by gyom (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 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 16 Aug 2012 03:46:00 PM UTCjordighStatusPatch Submitted=>Fixed
      Open/ClosedOpen=>Closed
    Wed 15 Aug 2012 02:26:43 PM UTCjordighAttached File-=>Added cholmod.patch, #26362
    Tue 14 Aug 2012 07:58:52 PM UTCjordighAttached File-=>Added cholmod.patch, #26361
      StatusConfirmed=>Patch Submitted
    Tue 14 Aug 2012 04:27:10 PM UTCjordighAssigned toNone=>jordigh
    Tue 14 Aug 2012 04:25:26 PM UTCcdfStatusNone=>Confirmed
      SummarySegfault with CHOL and a second output argument=>Segfault when calling chol () on non-SPD sparse matrix and requesting a second output argument

    Back to the top


    Powered by Savane 3.1-cleanup