Fix a segment fault issue in cascade classfier
work_var_count and sample_count are both 32bit integer, if the product of work_var_count and sample_count is bigger than 2^31, the compiler will treat (work_var_count*sample_count) as a negative number. Force work_var_count as an unsigned 64bit integer to avoid this issue.
This commit is contained in:
@@ -1200,7 +1200,7 @@ CvBoost::update_weights( CvBoostTree* tree )
|
||||
if (data->is_buf_16u)
|
||||
{
|
||||
unsigned short* labels = (unsigned short*)(dtree_data_buf->data.s + data->data_root->buf_idx*length_buf_row +
|
||||
data->data_root->offset + (data->work_var_count-1)*data->sample_count);
|
||||
data->data_root->offset + (size_t)(data->work_var_count-1)*data->sample_count);
|
||||
for( i = 0; i < n; i++ )
|
||||
{
|
||||
// save original categorical responses {0,1}, convert them to {-1,1}
|
||||
@@ -1218,7 +1218,7 @@ CvBoost::update_weights( CvBoostTree* tree )
|
||||
else
|
||||
{
|
||||
int* labels = dtree_data_buf->data.i + data->data_root->buf_idx*length_buf_row +
|
||||
data->data_root->offset + (data->work_var_count-1)*data->sample_count;
|
||||
data->data_root->offset + (size_t)(data->work_var_count-1)*data->sample_count;
|
||||
|
||||
for( i = 0; i < n; i++ )
|
||||
{
|
||||
|
Reference in New Issue
Block a user