Add a New Comment (Rich Markup)
Comment Type & Canned Response: None None > Multiple Canned Responses Fixed in development Crash with no stack trace Already fixed in newer version Fixed in stable Bad description Bad description and crash Bad stack trace Obsolete version Duplicate and not fixed Duplicate and needs more info Duplicate and fixed Need info and old
I fixed the issue in this cset https://hg.savannah.gnu.org/hgweb/octave/rev/1582a6140275. This was done on the stable branch and will be part of the next bug fix release of Octave.
Here is a backtrace of the segfault.
0x00007f07b9270637 in octave::refcount<long>::operator-- ( this=0x7f07b9071250 <vtable for octave::tree_identifier+24>) at ./liboctave/util/oct-refcount.h:96 96 return OCTAVE_ATOMIC_DECREMENT (&m_count); (gdb) bt #0 0x00007f07b9270637 in octave::refcount<long>::operator-- ( this=0x7f07b9071250 <vtable for octave::tree_identifier+24>) at ./liboctave/util/oct-refcount.h:96 #1 0x00007f07b92700d8 in octave_value::operator= (this=0x7f07802f4130, a=...) at ./libinterp/octave-value/ov.h:360 #2 0x00007f07b831cbc2 in Array<octave_value>::diag (this=0x7f07803b04b0, m=2, n=1) at ./liboctave/array/Array.cc:2621 #3 0x00007f07b860d753 in Cell::diag (this=0x7f07803b04b0, m=2, n=1) at libinterp/corefcn/Cell.cc:354 #4 0x00007f07b83fd82c in octave_base_matrix<Cell>::diag (this=0x7f07803b04a0, m=2, n=1) at libinterp/octave-value/ov-base-mat.h:136 #5 0x00007f07b86e3eaf in octave_value::diag (this=0x7f078ea00310, m=2, n=1) at ./libinterp/octave-value/ov.h:1311 #6 0x00007f07b86bd959 in Fdiag (args=...) at libinterp/corefcn/data.cc:1237
Of course, it's not at all where I expected it to be.
Rik, your point stands regardless, but to be clear: based on the behavior when using numerical arrays, I believe that the example I gave that segfaulted did have valid input, and therefore it should neither segfault (obviously) nor give an error.
Confirmed. The segfault is still present on the current stable release, 5.1.0. Even if the input is invalid, the interpreter should merely flag an error--never segfault. I have raised the priority to high.
I am running Octave 4.4.1 on Xubuntu 19.04. Example:
diag([1, 1], 2, 1)
returns
ans = Diagonal Matrix 1 0
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).
(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)
Attach Files: Comment:
No files currently attached
Depends on the following items: None found
Items that depend on this one: None found
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Only project members can vote.
Please enter the title of George Orwell's famous dystopian book (it's a date):
Follow 6 latest changes.
Copyright © 2022 Free Software Foundation, Inc. Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved. The Levitating, Meditating, Flute-playing Gnu logo is a GNU GPL'ed image provided by the Nevrax Design Team. Source Code
Powered by Savane 3.9