Mercurial > hg > octave-shane
changeset 9286:c2248cc4821a
don't crash on assignments like a() = 1
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 02 Jun 2009 09:57:44 +0200 |
parents | 226f6d001ee2 |
children | a407e894ec74 |
files | src/ChangeLog src/ov-base.cc src/ov-cell.cc src/ov-list.cc src/ov-struct.cc |
diffstat | 5 files changed, 32 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2009-06-02 Jaroslav Hajek <highegg@gmail.com> + + * ov-base.cc (octave_base_value::numeric_assign): Gripe when no index + given. + * ov-cell.cc (octave_cell::subsasgn): Ditto. + * ov-struct.cc (octave_struct::subsasgn): Ditto. + * ov-list.cc (octave_list::subsasgn): Ditto. + 2009-05-28 John W. Eaton <jwe@octave.org> * load-path.cc (load_path::do_files): Avoid shadow warning from GCC.
--- a/src/ov-base.cc +++ b/src/ov-base.cc @@ -1203,6 +1203,12 @@ { octave_value retval; + if (idx.front ().empty ()) + { + error ("missing index in indexed assignment"); + return retval; + } + int t_lhs = type_id (); int t_rhs = rhs.type_id ();
--- a/src/ov-cell.cc +++ b/src/ov-cell.cc @@ -216,6 +216,12 @@ clear_cellstr_cache (); + if (idx.front ().empty ()) + { + error ("missing index in indexed assignment"); + return retval; + } + if (n > 1) { switch (type[0])