From f77e12ff2f3d8a9b28484e9ee8a8220c754a098f Mon Sep 17 00:00:00 2001 From: Saurabh Date: Fri, 22 Apr 2022 12:14:18 -0600 Subject: [PATCH] add checks to make sure access won't be out of bounds --- nalgebra-sparse/src/ops/serial/cs.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nalgebra-sparse/src/ops/serial/cs.rs b/nalgebra-sparse/src/ops/serial/cs.rs index f65b5071..cc13c168 100644 --- a/nalgebra-sparse/src/ops/serial/cs.rs +++ b/nalgebra-sparse/src/ops/serial/cs.rs @@ -30,6 +30,8 @@ pub fn spmm_cs_prealloc_unchecked( where T: Scalar + ClosedAdd + ClosedMul + Zero + One, { + assert_eq!(c.pattern().major_dim(), a.pattern().major_dim()); + assert_eq!(c.pattern().minor_dim(), b.pattern().minor_dim()); let some_val = Zero::zero(); let mut scratchpad_values: Vec = vec![some_val; b.pattern().minor_dim()]; for i in 0..c.pattern().major_dim() {