Out-of-bounds third index of multidimensional array causes segfault
John W. Eaton
jwe at octave.org
Sat Apr 25 07:35:33 CDT 2009
On 23-Apr-2009, Brooks Moses wrote:
| Bug report for Octave 3.0.3 configured for i686-pc-cygwin
|
| Description:
| -----------
|
| When I attempt to access an element of a three-dimensional array for set
| of indices for which the third index is out of bounds, I get a segfault.
|
| Repeat-By:
| ---------
|
| As per the following session:
|
| > octave:1> a(2,2,2)=2
| > a =
| >
| > ans(:,:,1) =
| >
| > 0 0
| > 0 0
| >
| > ans(:,:,2) =
| >
| > 0 0
| > 0 2
| >
| >
| >
| > octave:2> a(3,1,1)
| > error: invalid row index = 3
| > octave:2> a(1,3,1)
| > error: invalid column index = 3
| > octave:2> a(1,1,3)
| > panic: Segmentation fault -- stopping myself...
I can't reproduce this problem with Octave 3.0.3 or the current
development sources on my system (Debian x86_64-pc-linux-gnu). I see
octave:1> a(2,2,2)=2
a =
ans(:,:,1) =
0 0
0 0
ans(:,:,2) =
0 0
0 2
octave:2> a(3,1,1)
error: invalid row index = 3
octave:2> a(1,3,1)
error: invalid column index = 3
octave:2> a(1,1,3)
error: invalid index = 3
with 3.0.3. With the current development sources the result is similar
but the message is always
error: A(I): Index exceeds matrix dimension.
jwe
More information about the Bug-octave
mailing list