fix out-of-bounds access in orhr_col#1018
Merged
langou merged 1 commit intoReference-LAPACK:masterfrom May 24, 2024
Merged
Conversation
Collaborator
Author
|
LAPACK++ commit c52719c works around this bug, so test with a version prior to that. |
martin-frbg
approved these changes
May 23, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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_colandunhr_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 allnbtonb_, right?)Checklist