Skip to content

Bounds-check pivptr in *pivotL.c before accessing lsub_ptr on singular matrix - #178

Merged
xiaoyeli merged 1 commit into
xiaoyeli:masterfrom
rgommers:fix-bounds-check-pivotL
Aug 1, 2026
Merged

Bounds-check pivptr in *pivotL.c before accessing lsub_ptr on singular matrix#178
xiaoyeli merged 1 commit into
xiaoyeli:masterfrom
rgommers:fix-bounds-check-pivotL

Conversation

@rgommers

Copy link
Copy Markdown
Contributor

When the matrix is singular (pivmax == 0.0), pivptr may be out of bounds for lsub_ptr (pivptr >= nsupr). Add a guard to use diagind as the pivot row when pivptr is out of range.

Upstreamed from SciPy, which has carried this patch for a long time.

Also cleans up some code that was ifdef'd out already.

Split off from PR gh-174, since that one is current blocked on performance-related concerns of unrelated commits.

…ingular matrix

When the matrix is singular (pivmax == 0.0), pivptr may be out of bounds
for lsub_ptr (pivptr >= nsupr). Add a guard to use diagind as the pivot
row when pivptr is out of range.

Upstreamed from SciPy, which has carried this patch for a long time.

Also cleans up some code that was ifdef'd out already.
@xiaoyeli
xiaoyeli merged commit 2a4e269 into xiaoyeli:master Aug 1, 2026
@rgommers
rgommers deleted the fix-bounds-check-pivotL branch August 3, 2026 14:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants