Address #4042: Prevent out-of-range access in column matrix (#4231)

This commit is contained in:
Philip Hyunsu Cho 2019-03-08 17:11:42 -08:00 committed by GitHub
parent 331cd3e4f7
commit f83e62dca5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -163,7 +163,8 @@ class ColumnMatrix {
to determine type of bin id's */ to determine type of bin id's */
inline Column GetColumn(unsigned fid) const { inline Column GetColumn(unsigned fid) const {
Column c(type_[fid], &index_[boundary_[fid].index_begin], index_base_[fid], Column c(type_[fid], &index_[boundary_[fid].index_begin], index_base_[fid],
&row_ind_[boundary_[fid].row_ind_begin], (type_[fid] == ColumnType::kSparseColumn ?
&row_ind_[boundary_[fid].row_ind_begin] : nullptr),
boundary_[fid].index_end - boundary_[fid].index_begin); boundary_[fid].index_end - boundary_[fid].index_begin);
return c; return c;
} }