File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # LMMsolver 1.0.14.9000
2+
3+ - Fixed an out-of-bounds read in ` convertSparseMatrix() ` when checking a sparse pattern mismatch.
4+
15# LMMsolver 1.0.14
26
37- Improved computational efficiency of supernodal Cholesky and its automatic differentiation.
Original file line number Diff line number Diff line change @@ -166,37 +166,23 @@ NumericVector convertSparseMatrix(const SparseMatrix& A,
166166 int k = rowpointers[J + 1 ] - 1 ;
167167 int ndx = colpointers[j + 1 ] - 1 ;
168168
169- for (int ll = A.rowpointers [j + 1 ] - 1 ; ll >= A.rowpointers [j]; ll--)
169+ const int kmin = rowpointers[J];
170+
171+ for (int ll = A.rowpointers [j + 1 ] - 1 ; ll >= A.rowpointers [j];ll--)
170172 {
171173 int c = A.colindices [ll];
172174
173175 if (c < j)
174176 break ;
175177
176- while (rowindices[k] != c)
178+ while (k >= kmin && rowindices[k] != c)
177179 {
178180 k--;
179181 ndx--;
180182 }
181183
182- if (k < 0 )
183- {
184- // Rcpp::Rcout << "\nPattern mismatch\n";
185- // Rcpp::Rcout << "Column j = " << j
186- // << ", searching for row c = " << c << "\n";
187-
188- // Rcpp::Rcout << "\nSparseMatrix column rows: ";
189- // for (int t = A.rowpointers[j]; t < A.rowpointers[j + 1]; t++)
190- // Rcpp::Rcout << A.colindices[t] << " ";
191-
192- // Rcpp::Rcout << "\nAD column rows: ";
193- // for (int t = colpointers[j]; t < colpointers[j + 1]; t++)
194- // Rcpp::Rcout << rowindices[t] << " ";
195-
196- // Rcpp::Rcout << "\n";
197-
184+ if (k < kmin)
198185 Rcpp::stop (" Pattern mismatch" );
199- }
200186
201187 result[ndx] = A.entries [ll];
202188
You can’t perform that action at this time.
0 commit comments