(C, Z)GESVD stack corruption issue

Post here if you want to report a bug to the LAPACK team

(C, Z)GESVD stack corruption issue

Postby zotkevich » Mon Sep 16, 2013 5:47 am


We recently found a stack corruption issue in (C,Z)GESVD that potentially could even lead to incorrect xerbla error message.

In ZGESVD array DUM which is used in LWORK query is a double precision array of size 1 allocated on stack:


DUM comes to ( ZGEQRF, ZUNGQR, ... ) as a WORK array to return an optimal LWORK value.

But in ( ZGEQRF, ZUNGQR, ... ) array WORK is declared as a COMPLEX*16 array. So WORK(1) = 1 corrupts the stack as it deals with complex value while pointer on input of the function is a pointer to double:

(oooooooo|xxxxxxxx), oooooooo fills with LWORK value, xxxxxxxx corrupts. Let compiler use xxxxxxxx to hold some value. After LWORK query the value will turn to be a zero.

"Hacky fix" would be to allocate DUM array of size 2.

Alex Zotkevich
Posts: 13
Joined: Tue Dec 21, 2010 2:41 am
Location: Intel Co.

Re: (C, Z)GESVD stack corruption issue

Postby Julien Langou » Tue Nov 26, 2013 4:01 pm

Hi Alex, thanks for the bug report! Should be fix as of Revision 1455 of LAPACK. Cheers, Julien.
Julien Langou
Posts: 835
Joined: Thu Dec 09, 2004 12:32 pm
Location: Denver, CO, USA

Return to Bug report

Who is online

Users browsing this forum: No registered users and 3 guests