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:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  Jordi Gutiérrez Hermoso <jordigh>
Originator Name:  Guillaume Open/Closed:  Closed
Release:  dev Operating 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)

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 Files:
   
   
Comment:
   

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

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jordigh (Posted a comment)
  • -email is unavailable- added by cdf (Posted a comment)
  • -email is unavailable- added by gyom (Submitted the item)
  •  

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

    Only project members can vote.

     

     

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-08-16 jordigh StatusPatch Submitted => Fixed
        Open/ClosedOpen => Closed
    2012-08-15 jordigh Attached File- => Added cholmod.patch, #26362
    2012-08-14 jordigh Attached File- => Added cholmod.patch, #26361
        StatusConfirmed => Patch Submitted
    2012-08-14 jordigh Assigned toNone => jordigh
    2012-08-14 cdf StatusNone => 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.4