fixed potential buffer size overflow in Boost::update_weight, bug #1524 (thanks to benlemna for the patch)

This commit is contained in:
Vadim Pisarevsky 2012-03-26 09:53:52 +00:00
parent f341ce2665
commit 8bb422b1fc

View File

@ -1126,7 +1126,7 @@ CvBoost::update_weights( CvBoostTree* tree )
int *sample_idx_buf;
const int* sample_idx = 0;
cv::AutoBuffer<uchar> inn_buf;
int _buf_size = (params.boost_type == LOGIT) || (params.boost_type == GENTLE) ? data->sample_count*sizeof(int) : 0;
size_t _buf_size = (params.boost_type == LOGIT) || (params.boost_type == GENTLE) ? data->sample_count*sizeof(int) : 0;
if( !tree )
_buf_size += n*sizeof(int);
else