Mercurial > jwe > octave
changeset 20125:274b52724931
Stop segfault when using empty indexing of a classdef object.
* ov-classdef.cc (cdef_object_array::subsref): Emit an error if '()' empty
indexing is used.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 23 Apr 2015 17:03:14 -0700 |
parents | 6ee26f894346 |
children | d34e31b07966 |
files | libinterp/octave-value/ov-classdef.cc |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-classdef.cc Tue Apr 21 15:37:10 2015 +0100 +++ b/libinterp/octave-value/ov-classdef.cc Thu Apr 23 17:03:14 2015 -0700 @@ -1629,6 +1629,13 @@ bool is_scalar = true; Array<idx_vector> iv (dim_vector (1, ival.length ())); + if (ival.empty ()) + { + ::error ("can't index %s object(s) with empty parentheses", + class_name ().c_str ()); + break; + } + for (int i = 0; ! error_state && i < ival.length (); i++) { iv(i) = ival(i).index_vector ();