-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix access violation exception that can occur during invocation of loop lambda function when inner_start >= inner_end in 'For' template. #3936
Conversation
…datasets. Prior to this change, the line "score_t threshold = tmp_gradients[top_k - 1];" would generate an exception, since tmp_gradients would be empty when the cnt input value to the function is zero.
…data set given as of array of pointers to rows (as opposed to existing method LGBM_BoosterPredictForMat which requires data given as contiguous array)
…op lambda function when inner_start >= inner_end in 'For' template. In particular, this can occur in Tree::AddPredictionToScore on line 291 where the loop lambda function body (created by the PredictionFun macro) dereferences used_data_indices[start]. For reference, the particular case which triggered this exception in my case was: * start = 0 * end = 93,203 * n_block = 56 * min_block_size = 512 for which the BlockInfo method gave: * n_block = 56 * num_inner = 1,696 and so, for the case i=55 (i.e., the last case in the loop), we get * inner_start = start + num_inner * i = 93,280 which is greater than 'end' and hence triggers the exception.
cc @shiyu1994 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
I've checked all the |
This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this. |
In particular, this can occur in
Tree::AddPredictionToScore
on line 291 of src\io\tree.cpp where the loop lambda function body (created by thePredictionFun
macro) dereferencesused_data_indices[start]
.For reference, the particular case which triggered this exception in my case was:
start
= 0end
= 93,203min_block_size
= 512for which the
BlockInfo
method gave:n_block
= 56num_inner
= 1,696and so, for the case
i=55
(i.e., the last case in the loop), we getinner_start = start + num_inner * i
= 93,280which is greater than 'end' and hence triggers the exception.