# HG changeset patch # User jwe # Date 820981900 0 # Node ID 0892abda7553a8178fe53b679d8d96a0aac5fb86 # Parent 597c3ca9f6e85d493ccd05bc400526eef8e9b304 [project @ 1996-01-07 02:28:21 by jwe] diff --git a/liboctave/Array.cc b/liboctave/Array.cc --- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -393,8 +393,8 @@ { int a_rows = a.rows (); int a_cols = a.cols (); - if (r < 0 || r + a_rows - 1 > rows () - || c < 0 || c + a_cols - 1 > cols ()) + + if (r < 0 || r + a_rows > rows () || c < 0 || c + a_cols > cols ()) { (*current_liboctave_error_handler) ("range error for insert"); return *this; diff --git a/liboctave/dMatrix.cc b/liboctave/dMatrix.cc --- a/liboctave/dMatrix.cc +++ b/liboctave/dMatrix.cc @@ -129,7 +129,7 @@ Matrix::insert (const RowVector& a, int r, int c) { int a_len = a.length (); - if (r < 0 || r >= rows () || c < 0 || c + a_len - 1 > cols ()) + if (r < 0 || r >= rows () || c < 0 || c + a_len > cols ()) { (*current_liboctave_error_handler) ("range error for insert"); return *this; @@ -145,7 +145,7 @@ Matrix::insert (const ColumnVector& a, int r, int c) { int a_len = a.length (); - if (r < 0 || r + a_len - 1 > rows () || c < 0 || c >= cols ()) + if (r < 0 || r + a_len > rows () || c < 0 || c >= cols ()) { (*current_liboctave_error_handler) ("range error for insert"); return *this; @@ -163,8 +163,7 @@ int a_nr = a.rows (); int a_nc = a.cols (); - if (r < 0 || r + a_nr - 1 > rows () - || c < 0 || c + a_nc - 1 > cols ()) + if (r < 0 || r + a_nr > rows () || c < 0 || c + a_nc > cols ()) { (*current_liboctave_error_handler) ("range error for insert"); return *this;