octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #34868] subsref crashes octave


From: Rik
Subject: [Octave-bug-tracker] [bug #34868] subsref crashes octave
Date: Mon, 21 Nov 2011 18:58:54 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20100101 Firefox/5.0

Update of bug #34868 (project octave):

                  Status:                    None => Patch Submitted        

    _______________________________________________________

Follow-up Comment #1:

This is a wonderful core dump.  It occurs on all Octave versions that I have
tried including 3.0, 3.2.x, 3.4.x, and the development branch.  And it is not
platform specific since I run Linux and you reported this on Mac OS.

First, subsref wants a character or cell array of indices for the second
argument, not an ordinary matrix.  To have this work, even in the ordinary
case, one would need to make subs a cell array.  For example:


a = 1:4;
b.type = "()";
b.subs = {1:2};
subsref (a,b)
=> 1:2


The problem seems to be that b(2:end) is a 1x0 empty struct array.  It passes
the input validation tests of subsref in the function decode_subscripts in
utils.cc because that function *only* checks whether the two fields "type" and
"subs" exist.  It doesn't bother to check whether the fields are empty.

I just put in a simple test to see whether the fields are empty and now your
original code passes.  See the patch attached to this bug report.  If that
seems like the correct behavior I can commit it to the development branch.


(file #24416)
    _______________________________________________________

Additional Item Attachment:

File name: subsref.patch                  Size:0 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?34868>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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