[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #56711] Three input form of diag can segfault

From: Travis Arnold
Subject: [Octave-bug-tracker] [bug #56711] Three input form of diag can segfault if a cell array is passed
Date: Fri, 2 Aug 2019 17:58:05 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36


                 Summary: Three input form of diag can segfault if a cell
array is passed
                 Project: GNU Octave
            Submitted by: teerav42
            Submitted on: Fri 02 Aug 2019 09:58:04 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Segfault, Bus Error, etc.
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.4.1
        Operating System: GNU/Linux



I am running Octave 4.4.1 on Xubuntu 19.04. Example:

diag([1, 1], 2, 1)


ans =

Diagonal Matrix


which is fine (although now that I look at it perhaps that is also a small
bug, as that matrix is not diagonal if one subscribes to the convention that
only square matrices may be labeled diagonal; I digress however).

In contrast,

diag({1, 1}, 2, 1)

results in a segfault:

fatal: caught signal Segmentation fault -- stopping myself...
Segmentation fault (core dumped)

This seems to occur when the first argument is a cell array and either M or N
(the second and third arguments, respectively) is less than the number of
elements in the cell.

Matlab compatibility is not a concern here, as Matlab's version of diag does
not support cell arrays or the three input version (in fact, the way I found
this bug was by reimplementing a version of diag for Matlab so that it does
support these features).


Reply to this item at:


  Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]