fix out-of-bounds access in orhr_col #1018
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
In
orhr_col
andunhr_col
, it says "if NB > N, then N is used instead of NB" and LDT >= max( 1, min( NB, N ) ).However, lines 423–425 have
If N < NB and LDT = N, this will set T out-of-bounds. The LAPACK++ tester encounters an invalid pointer, typically due to memory being overwritten, and aborts:
With NB ≤ N, it passes:
This is with reference LAPACK v3.12.0. Also occurs with intel-oneapi-mkl/2023.2.
Being Fortran, I guess the simplest solution is to use
With this change, it passes:
(With C call-by-value semantics, I would simply set
nb = min( nb, n )
near the top. With Fortran's call-by-reference semantics, that would require adding a local variable,nb_ = min( nb, n )
and changing allnb
tonb_
, right?)Checklist