Skip to content

Fix two cases of signed integer overflow. #9073

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

Merged
merged 1 commit into from
Aug 24, 2017

Conversation

craigcitro
Copy link
Contributor

PR Summary

This tweaks two cases where there is potential for signed integer overflow:

  • in rewind_scanlines, we switch to unsigned ints
  • in not_equal, we switch for operations which cannot overflow.

These cases were caught by matplotlib-using tests being run under
ASan with a check for signed integer
overflow.

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

I did not see an easy way to add a test for this; I am happy to do so if someone has thoughts on a good place to include a test. (The "right" test to add would be a variant of the test suite running under ASan, but that seems a bit heavy for a small PR.)

This tweaks two cases where there is potential for signed integer overflow:
* in `rewind_scanlines`, we switch to unsigned ints
* in `not_equal`, we switch for operations which cannot overflow.

These cases were caught by matplotlib-using tests being run under
[ASan](https://github.com/google/sanitizers) with a check for signed integer
overflow.
@craigcitro
Copy link
Contributor Author

/cc @shoyer

@QuLogic QuLogic requested a review from mdboom August 22, 2017 23:38
@tacaswell tacaswell added this to the 2.2 (next next feature release) milestone Aug 23, 2017
@dopplershift
Copy link
Contributor

Travis passed but for some reason is reporting pending here. Merging...

@dopplershift dopplershift merged commit 0b95ba1 into matplotlib:master Aug 24, 2017
@QuLogic QuLogic modified the milestones: 2.1 (next point release), 2.2 (next next feature release) Aug 24, 2017
@tacaswell
Copy link
Member

tacaswell commented Aug 24, 2017

At some point we need to make a big diff of everything we have patched on agg and push it to upstream....

@tacaswell
Copy link
Member

@craigcitro Thanks!

Can I ask why you decided do this?

@craigcitro craigcitro deleted the uint branch August 24, 2017 02:32
@craigcitro
Copy link
Contributor Author

@tacaswell we use matplotlib internally at Google. Someone had some matplotlib-using tests that they wanted to pass with extra checks in place, so rather than just maintain their patch internally, I thought I'd upstream it. 😉

@QuLogic
Copy link
Member

QuLogic commented Aug 24, 2017

@tacaswell I have this list, though probably need to update it quite a bit.

@tacaswell
Copy link
Member

I think we can generate it via git pick-axe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants