bugGNU Octave - Bugs: bug #40364, segfault when comparing large...


bug #40364: segfault when comparing large sparse matrices for equality

Submitted by:  David Spies <dspyz>
Submitted on:  Thu 24 Oct 2013 06:40:55 PM UTC  
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Segfault, Bus Error, etc.
Status: FixedAssigned to: None
Originator Name: Open/Closed: Closed
Release: devOperating System: GNU/Linux

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)

Mon 04 Nov 2013 10:04:20 PM UTC, comment #8:

About getting involved, this is a FAQ:


I just added a note about how running Octave in a debugger is a very good way to learn how it works.

Jordi GutiƩrrez Hermoso <jordigh>
Project Administrator
Sat 02 Nov 2013 07:48:43 AM UTC, comment #7:

I think the best way to get involved is to read the code, maybe try to fix a bug, join the maintainers mailing list and ask questions, or ask questions on the IRC channel. There's no short cut and there's no formal guide.

John W. Eaton <jwe>
Project Administrator
Fri 01 Nov 2013 04:29:15 PM UTC, comment #6:

Thanks John,

Given an OOM with a stack trace, I can recognize that and change my code to say

assert(nnz(mutex != mutex') == 0);

David Spies <dspyz>
Fri 01 Nov 2013 04:24:52 PM UTC, comment #5:

Thanks Rik,

I'd like to get involved in Octave development more, but I've never actually looked at the source code. I just post bugs I happen to encounter while working on my project (Preprocessing SAT/ASP grounded problem instances to generate binary nogood clauses).

What's the best way to get started understanding the Octave code?

David Spies <dspyz>
Fri 01 Nov 2013 04:24:43 PM UTC, comment #4:

I checked in the following change:


With this change you'll get an out of memory error instead of a crash. I think that's the best you can expect in this case since you are generating a matrix full of ones that is too large for 32-bit Octave to represent.

John W. Eaton <jwe>
Project Administrator
Fri 01 Nov 2013 03:34:09 PM UTC, comment #3:

Andreas has done a good job diagnosing where the problem code is. I'm adding David to the e-mail list in the hopes that he has a quick idea about how to fix the constructor.

Rik <rik5>
Project Administrator
Thu 31 Oct 2013 07:59:52 PM UTC, comment #2:

I want to clarify that my backtrace was the result from David Spies's test case. In his code there is an

The same segfault can be reproduced with

This is because in the constructor in Sparse.h:88
nz overflows for int32 when called in

Andreas Weber <andy1978>
Project Member
Thu 31 Oct 2013 06:40:38 PM UTC, comment #1:

A short example which triggers this bug is


Andreas Weber <andy1978>
Project Member
Thu 24 Oct 2013 06:40:55 PM UTC, original submission:

I've attached the functions I use and the data that causes the segfault. Run totalClosure(constraints,mutex)

David Spies <dspyz>


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

Attach File(s):

Attached Files
file #29464:  andnot.m added by dspyz (233B - text/x-objcsrc - Sorry, I forgot this one)
file #29463:  crash.tar.gz added by dspyz (2MiB - application/x-gzip)


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 jwe (Posted a comment)
  • -unavailable- added by rik5 (Posted a comment)
  • -unavailable- added by rik5
  • -unavailable- added by andy1978 (Posted a comment)
  • -unavailable- added by dspyz (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 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 02 Nov 2013 07:48:43 AM UTCjweStatusConfirmed=>Fixed
    Fri 01 Nov 2013 03:34:09 PM UTCrik5Carbon-Copy-=>Added dbateman
    Thu 31 Oct 2013 07:59:52 PM UTCandy1978StatusNone=>Confirmed
      SummaryOctave consistently segfaults when this method is run on the attached data=>segfault when comparing large sparse matrices for equality
    Thu 24 Oct 2013 06:42:24 PM UTCdspyzAttached File-=>Added andnot.m, #29464
    Thu 24 Oct 2013 06:40:55 PM UTCdspyzAttached File-=>Added crash.tar.gz, #29463

    Back to the top

    Powered by Savane 3.1-cleanup1