LAPACK Archives

[Lapack] [BUG OF LAPACKE] lapacke_zstegr_work doesn't check ldz correctl

Hi Hong, 

Ooopsee ? well, you are totally correct. Ouch that's a pretty nasty one.
Thanks for the patch. All four precisions are affected. This is corrected
in the SVN repository. See below. Thanks!

Best, 
Julien.


===========================================================================
==============

Author: langou
Date: Mon Jul 22 19:01:15 2013
New Revision: 1425

URL: https://icl.cs.utk.edu/trac/lapack-dev/changeset/1425
Log:

apply patch from Hong Xu

patch sent to lapack mailing list on Sunday July 21st

In the input parameter checking, LDZ was not checked correctly
LDZ was checked against M instead of N essentially



Modified:
    lapack/trunk/lapacke/src/lapacke_cstegr_work.c
    lapack/trunk/lapacke/src/lapacke_dstegr_work.c
    lapack/trunk/lapacke/src/lapacke_sstegr_work.c
    lapack/trunk/lapacke/src/lapacke_zstegr_work.c

Modified: lapack/trunk/lapacke/src/lapacke_cstegr_work.c
URL: 
https://icl.cs.utk.edu/trac/lapack-dev/file/lapack/trunk/lapacke/src/lapack
e_cstegr_work.c?rev=1425
===========================================================================
===
--- lapack/trunk/lapacke/src/lapacke_cstegr_work.c (original)
+++ lapack/trunk/lapacke/src/lapacke_cstegr_work.c Mon Jul 22 19:01:15 2013
@@ -55,7 +55,7 @@
         lapack_int ldz_t = MAX(1,n);
         lapack_complex_float* z_t = NULL;
         /* Check leading dimension(s) */
-        if( ldz < *m ) {
+        if( ( LAPACKE_lsame( jobz, 'v' ) && ( ldz < ldz_t )  ) || ( ldz <
1 ) ) {
             info = -15;
             LAPACKE_xerbla( "LAPACKE_cstegr_work", info );
             return info;

Modified: lapack/trunk/lapacke/src/lapacke_dstegr_work.c
URL: 
https://icl.cs.utk.edu/trac/lapack-dev/file/lapack/trunk/lapacke/src/lapack
e_dstegr_work.c?rev=1425
===========================================================================
===
--- lapack/trunk/lapacke/src/lapacke_dstegr_work.c (original)
+++ lapack/trunk/lapacke/src/lapacke_dstegr_work.c Mon Jul 22 19:01:15 2013
@@ -54,7 +54,7 @@
         lapack_int ldz_t = MAX(1,n);
         double* z_t = NULL;
         /* Check leading dimension(s) */
-        if( ldz < *m ) {
+        if( ( LAPACKE_lsame( jobz, 'v' ) && ( ldz < ldz_t )  ) || ( ldz <
1 ) ) {
             info = -15;
             LAPACKE_xerbla( "LAPACKE_dstegr_work", info );
             return info;

Modified: lapack/trunk/lapacke/src/lapacke_sstegr_work.c
URL: 
https://icl.cs.utk.edu/trac/lapack-dev/file/lapack/trunk/lapacke/src/lapack
e_sstegr_work.c?rev=1425
===========================================================================
===
--- lapack/trunk/lapacke/src/lapacke_sstegr_work.c (original)
+++ lapack/trunk/lapacke/src/lapacke_sstegr_work.c Mon Jul 22 19:01:15 2013
@@ -54,7 +54,7 @@
         lapack_int ldz_t = MAX(1,n);
         float* z_t = NULL;
         /* Check leading dimension(s) */
-        if( ldz < *m ) {
+        if( ( LAPACKE_lsame( jobz, 'v' ) && ( ldz < ldz_t )  ) || ( ldz <
1 ) ) {
             info = -15;
             LAPACKE_xerbla( "LAPACKE_sstegr_work", info );
             return info;

Modified: lapack/trunk/lapacke/src/lapacke_zstegr_work.c
URL: 
https://icl.cs.utk.edu/trac/lapack-dev/file/lapack/trunk/lapacke/src/lapack
e_zstegr_work.c?rev=1425
===========================================================================
===
--- lapack/trunk/lapacke/src/lapacke_zstegr_work.c (original)
+++ lapack/trunk/lapacke/src/lapacke_zstegr_work.c Mon Jul 22 19:01:15 2013
@@ -55,7 +55,7 @@
         lapack_int ldz_t = MAX(1,n);
         lapack_complex_double* z_t = NULL;
         /* Check leading dimension(s) */
-        if( ldz < *m ) {
+        if( ( LAPACKE_lsame( jobz, 'v' ) && ( ldz < ldz_t )  ) || ( ldz <
1 ) ) {
             info = -15;
             LAPACKE_xerbla( "LAPACKE_zstegr_work", info );
             return info;






On 7/21/13 8:45 PM, "Hong Xu" <hong@Domain.Removed> wrote:

Hi Lapack Team!

I think I've found a bug. In the C interface of lapacke_zstegr_work, ldz
is not checked correctly. In the patch attached, you can see that ldz is
currently used to compared with *m, which is a variable that may not be
initialized. The correct way should be checking it with ldz_t.

Thanks,
Hong


<Prev in Thread] Current Thread [Next in Thread>


For additional information you may use the LAPACK/ScaLAPACK Forum.
Or one of the mailing lists, or