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

Array::from_shape_vec panics on shapes that are too big for usize on the platform #852

Closed
bluss opened this issue Nov 28, 2020 · 0 comments · Fixed by #855
Closed

Array::from_shape_vec panics on shapes that are too big for usize on the platform #852

bluss opened this issue Nov 28, 2020 · 0 comments · Fixed by #855
Labels
Milestone

Comments

@bluss
Copy link
Member

bluss commented Nov 28, 2020

The test deny_wraparound_from_vec fails on 32-bit:

thread 'deny_wraparound_from_vec' panicked at 'attempt to multiply with overflow', ndarray/src/dimension/dimension_trait.rs:137:17

The following code panics for wraparound in multiplication:

let five_large = Array::from_shape_vec((3, 7, 29, 36760123, 823996703), five.clone());

The reason is that we use default_strides for this shape, before doing the size check of the shape. In this case, the strides wrap around (so this shape is clearly too big for the current platform).

The expected result is that Array::from_shape_vec should return an error for this input. Any methods in ShapeBuilder that may panic could need to be documented that way.

We should add a ci configuration that tests a 32-bit target.

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

Successfully merging a pull request may close this issue.

1 participant