Mercurial > hg > octave-lojdl
changeset 2917:5c285800ebe2
[project @ 1997-04-30 20:58:04 by jwe]
Array-idx.h
author | jwe |
---|---|
date | Wed, 30 Apr 1997 20:58:04 +0000 |
parents | 4e7bea116f24 |
children | c8e635ff1af4 |
files | liboctave/Array2-idx.h liboctave/ChangeLog |
diffstat | 2 files changed, 14 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/Array2-idx.h +++ b/liboctave/Array2-idx.h @@ -243,6 +243,9 @@ { idx++; new_nc--; + + if (idx == num_to_delete) + break; } if (new_nc > 0) @@ -253,7 +256,7 @@ idx = 0; for (int j = 0; j < nc; j++) { - if (j == idx_j.elem (idx)) + if (idx < num_to_delete && j == idx_j.elem (idx)) idx++; else { @@ -302,6 +305,9 @@ { idx++; new_nr--; + + if (idx == num_to_delete) + break; } if (new_nr > 0) @@ -312,7 +318,7 @@ idx = 0; for (int i = 0; i < nr; i++) { - if (i == idx_i.elem (idx)) + if (idx < num_to_delete && i == idx_i.elem (idx)) idx++; else {
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,9 @@ +Tue Apr 29 04:39:01 1997 John W. Eaton <jwe@bevo.che.wisc.edu> + + * Array2-idx.h (Array2<T>::maybe_delete_elements): Prevent + out-of-bounds indexing of the index array. + * Array-idx.h (Array<T>::maybe_delete_elements): Likewise. + Fri Mar 28 15:37:09 1997 John W. Eaton <jwe@bevo.che.wisc.edu> * LSODE.h (x_step_limit): New field.