Fix integer overflow in LAPACKE nancheck helpers for large matrices #1294
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.33) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.33 · 144 lines diff across 1 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.298
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1294"
general
weight: 0.35
martin-frbg
Hit this while running Cholesky on a 47000x47000 matrix through OpenBLAS:
LAPACKE_dpotrfsegfaults inLAPACKE_dtr_nancheckbefore the factorization even starts, becausejldaoverflows 32-bitlapack_intoncen = lda >= 46341.The
ge/gb/tp/tfhelpers already cast tosize_t, but a few others were missed:?tr_nancheck:a[i+jlda](this is the potrf path, also used by the po/sy/he checks)?_nancheck: thenincloop bound overflows when called with a large stride (e.g. from the hs/tf checks)?sp/?pp/?pf/?hp/?tp/?tf:len = n(n+1)/2overflows, the check then silently passes NaNs through?tz_nancheck: the part offsets overflow, widened toint64_tto keep the -1 sentinelThis bug also affects OpenBLAS (it vendors these files) - identical fix in OpenMathLib/OpenBLAS#5835.
Tested with UBSan at n = 47000: the old code reports signed integer overflow and either segfaults (tr, tz) or misses a planted NaN (vector, packed); the fixed code finds the NaN in all cases. Old and new give identical results on a sweep of small sizes covering all layouts/uplo/diag/shapes with a NaN at every position.