-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix mathtext image bounding box #4148
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
Conversation
I seem to be getting the same test failures on master as this (but Travis hasn't tested master in 5 days). Not sure what's up there... |
Some how travis got turned off |
No worries -- Oops... still turned off. |
Ok -- I think we're back in business. This is ready for a final review. |
|
||
for (size_t j = y0; j < y1 + 1; j++) { | ||
for (size_t i = x0; i < x1 + 1; i++) { | ||
for (size_t j = y0; j < y1; j++) { |
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.
This changes the limits in the case where m_width
is the minimum, is that intentional?
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.
Yes. x0 and x1 represent an inclusive range here, i.e. to fill, say, a one pixel line at pixel 5, x0 == 5, and x1 == 5. (One could argue that's not the best interface, but it's what we have). The problem is that occasionally, the line requested goes outside of the edge of the image, and we need to protect against that at all costs (because that would be a buffer overflow). This wasn't an issue in practice until the bounds of the image was corrected to something more accurate in mathtext.py
.
FIX : mathtext image bounding box
This fixes #4147, so that characters with a negative depth (such as the minus sign) are not arbitrarily clipped.
Going down that rabbit hole, discovered two other bugs related to text buffers, including a buffer overrun.
Fix #4147.