Unverified Commit f5f27ca8 authored by Jan Tilly's avatar Jan Tilly Committed by GitHub
Browse files

Upcast index to size_t in Refit (closes #3227) (#3228)

In the current implementation, the index is an int32, which will segfault with large data sets and a large number of estimators.
parent fc79b366
......@@ -345,7 +345,7 @@ class Booster {
std::vector<std::vector<int32_t>> v_leaf_preds(nrow, std::vector<int32_t>(ncol, 0));
for (int i = 0; i < nrow; ++i) {
for (int j = 0; j < ncol; ++j) {
v_leaf_preds[i][j] = leaf_preds[i * ncol + j];
v_leaf_preds[i][j] = leaf_preds[static_cast<size_t>(i) * static_cast<size_t>(ncol) + static_cast<size_t>(j)];
}
}
boosting_->RefitTree(v_leaf_preds);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment