From 2a60432170e9d5f51b5e6d01201d452068e66d4e Mon Sep 17 00:00:00 2001 From: Johnnie Gray Date: Fri, 19 Apr 2024 13:22:31 -0700 Subject: [PATCH] add explicit check for index type (currently u16) capacity --- src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index d12a7ff..29edbe0 100755 --- a/src/lib.rs +++ b/src/lib.rs @@ -152,6 +152,10 @@ impl ContractionProcessor { size_dict: Dict, track_flops: bool, ) -> ContractionProcessor { + if size_dict.len() > Ix::MAX as usize { + panic!("cotengrust: too many indices, maximum is {}", Ix::MAX); + } + let mut nodes: Dict = Dict::default(); let mut edges: Dict> = Dict::default(); let mut indmap: Dict = Dict::default();