Fix for #49489: Ensure length(ipiv)==n before calling LAPACK.getrs! to avoid segfaults #49602
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.
Fixes JuliaLang/LinearAlgebra.jl#1001, where the tests for MultiScaleArrays.jl causes a segfault.
getrs!does not ensurelength(ipiv) == nbefore LAPACK call, leading to a segfault.LU(factor, ipiv, info)with incompatible sizes forfactorandipiv, which, together with 1. above, causes a segfault.Fix:
getrs!and raiseDimensionMismatchiflength(ipiv) != n.LU(factor, ipiv, info)does not seem feasible as it handles square, thin, and thick matrices with varyingipivlengths.Unit test: Test case added to LinearAlgebra/test/lapack.jl to require
DimensionMismatchiflength(ipiv) != n.