Skip to content

Commit 4b022eb

Browse files
ssande7bluss
authored andcommitted
Make sure added capacity doesn't overflow usize::MAX
1 parent beb1439 commit 4b022eb

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/impl_owned_array.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,9 @@ where D: Dimension
828828
debug_assert!(axis.index() < self.ndim());
829829
let self_dim = self.raw_dim();
830830
let remaining_shape = self_dim.remove_axis(axis);
831+
832+
// Make sure added capacity doesn't overflow
833+
debug_assert!(remaining_shape.size().checked_mul(additional).is_some());
831834
let len_to_append = remaining_shape.size() * additional;
832835

833836
// Make sure new capacity is still in bounds

0 commit comments

Comments
 (0)