-
Notifications
You must be signed in to change notification settings - Fork 123
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
SofQW3 segfault #22194
SofQW3 segfault #22194
Conversation
const size_t nx = x_end - x_start; | ||
const size_t ny = y_end - y_start; | ||
const size_t nx = x_end - x_start + 1; | ||
const size_t ny = y_end - y_start + 1; | ||
const double ll_x(ll.X()), ll_y(ll.Y()), ul_y(ul.Y()); | ||
const double lr_x(lr.X()), lr_y(lr.Y()), ur_y(ur.Y()); | ||
// Check if there is only a output single bin and inputQ is fully enclosed |
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.
Is it correct that the next statement would now only fire if xend==x_start
ans y_end==y_start
?
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.
Doh! I think I completely missed the point. I just looked at the loop in the general code (calcGeneralIntersection
) and thought that it meant that when [xy]_start==[xy]_end
meant there is only one bin width, and that I had misunderstood what [xy]_end
meant. But actually the code before was right.
What [xy]_start == [xy]_end
means is that the bin width in that direction is zero, and this was what was causing the segmentation fault.
So, actually we can fix the segfault without changing so much of the code. I'll push another commit to do this...
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.
@mducle Are there any extra tests that are worth adding here?
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.
The extra protection avoids the crash when encountering a bin with zero width. Good to go and is safe to include in the patch.
Fixes an out-of-bounds index error in
FractionalRebinning
which causes a segmentation fault whenSofQW3
is called with certain parameters.To test:
Run the following script:
And check that no segfault occurs.
Fixes #22191.
Release Notes
Reviewer
Please comment on the following (full description):
Code Review
Functional Tests
Does everything look good? Mark the review as Approve. A member of
@mantidproject/gatekeepers
will take care of it.