Skip to content
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

BUG: Fix uint-overflow if padding with linear_ramp and negative gain. #14433

Merged
merged 1 commit into from Sep 5, 2019

Conversation

charris
Copy link
Member

@charris charris commented Sep 5, 2019

Backport of #14209.

In case end_value was greater than the edge values of the array to pad, the resulting difference was negative and caused overflows in case the input array used unsigned types. Fixed by using 1.17 version of linspace instead of _linear_ramp.

Protect against this regression with a new test for all numeric dtypes.

Fixes #14191.

linspace supports non-scalar values since version 1.16. This can replace
the former _linear_ramp method.

This removes a bug in the old implementation where certain edge and
end values resulted in an integer underflow for unsigned dtypes (see
numpygh-14191). Protect against this regression with a new test for all
numeric dtypes.
@charris charris added this to the 1.17.2 release milestone Sep 5, 2019
@charris charris changed the title BUG: Replace _linear_ramp with linspace BUG: Fix uint-overflow if padding with linear_ramp and negative gain. Sep 5, 2019
@charris charris merged commit b6ed3f1 into numpy:maintenance/1.17.x Sep 5, 2019
@charris charris deleted the backport-14209 branch September 5, 2019 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants