logo       

() should just give a error but goes to panic:: msg#00024

gnu.octave.bugs

Subject: () should just give a error but goes to panic:

On 19-Apr-2005, Etienne de Foras <e_deforas@xxxxxxxx> wrote:

| Hello,
|
| Just a bug:
|
| u=rand(10,10);
| u()=0 gives an error => ok.
|
| u=rand(10,10,10); (ND-Matrix)
| u()=0 hangs up and return to prompt, normal feeling?
|
| Thanks and See you.
|
| version=2.1.67

Please try the following patch.

Thanks,

jwe


liboctave/ChangeLog:

2005-04-19 John W. Eaton <jwe@xxxxxxxxxx>

* Array.cc (assignN): Don't crash if the index list is empty.


Index: liboctave/Array.cc
===================================================================
RCS file: /usr/local/cvsroot/octave/liboctave/Array.cc,v
retrieving revision 1.124.2.3
diff -u -r1.124.2.3 Array.cc
--- liboctave/Array.cc 1 Apr 2005 18:22:47 -0000 1.124.2.3
+++ liboctave/Array.cc 19 Apr 2005 14:44:17 -0000
@@ -2899,6 +2899,13 @@
{
lhs.maybe_delete_elements (idx, rfv);
}
+ else if (n_idx == 0)
+ {
+ (*current_liboctave_error_handler)
+ ("invalid number of indices for matrix expression");
+
+ retval = 0;
+ }
else if (n_idx == 1)
{
idx_vector iidx = idx(0);



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise