FirstIndexNext

[bug-gsl] array, vector indices out-of-bounds in "linalg/bidiag.c" (2008-04-20)

From: Kort Travis <kat@..................>
Subject: array, vector indices out-of-bounds in "linalg/bidiag.c"
Date: Sun, 20 Apr 2008 00:37:31 -0500
To: bug-gsl@gnu.org

Hi:

In porting the code in gsl-1.11 "linalg/bidiag.c" to work with complex matrices I found the following array/vector indices will most definitely be out-of-bounds when j==N:

linalg/bidiag.c: lines 308-317:

for (j = N; j > 0 && j--;)
{
/* Householder column transformation to accumulate U */
double tj = gsl_vector_get (tau_U, j);
double Ajj = gsl_matrix_get (A, j, j);
gsl_matrix_view m = gsl_matrix_submatrix (A, j, j, M-j, N-j);

gsl_vector_set (tau_U, j, Ajj);
gsl_linalg_householder_hm1 (tj, &m.matrix);
}


Note here that the _size_ of matrix A is M x N, with M >= N, and the _size_ of vector tau_U is min(M,N).

Almost certainly the index of the for loop should read:

"for (j = N-1; j > 0 && j--;)".


I hope that this can help the maintainers of this section! Unfortunately, at this point I work exclusively in C++, otherwise I would definitely offer more help to this project.


Thanks,



--
Kort Travis

--
Biomedical Optics and Nanodiagnostics
Sokolov research group, ENS 30
--

Department of Physics, RLM 5.208
University of Texas at Austin
Austin, TX 78712

email: kat@..................