Skip to content

[BUG] Segfault or wrong value on array with non-vanilla strides. #381

@lusewell

Description

@lusewell

Describe the bug
Segfault or wrong answer when running various functions on a numpy array with unusual strides. Looks like reading outside the array.

To Reproduce

import bottleneck
import numpy as np
data = np.zeros((1,500, 2)).transpose(1,2,0)
bottleneck.nanmax(data) # This inconsistently either segfaults or gives a non-zero very large number.

bottleneck = 1.3.2
numpy = 1.16.6
python = 3.7.7

Operating system is RHEL7.

I've also replicated on ubuntu with python 3.9 and numpy 1.20, (still bottleneck 1.3.2) so doesn't seem to be too sensitive to versions of other packages.

Expected behavior
The nanmax of this data should always be zero.

Additional context
This in turn breaks xarray.DataArray.max

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions