diff --git a/crates/openvino/src/blob.rs b/crates/openvino/src/blob.rs index 5372759..32a8410 100644 --- a/crates/openvino/src/blob.rs +++ b/crates/openvino/src/blob.rs @@ -58,6 +58,12 @@ impl Blob { let mut dimensions = MaybeUninit::uninit(); try_unsafe!(ie_blob_get_dims(blob, dimensions.as_mut_ptr()))?; + // Safety: this assertion is trying to avoid the improbable case where some future version + // of the OpenVINO library returns a dimensions array with size different than the one + // auto-generated in the bindings; see `struct dimensions` in + // `openvino-sys/src/generated/types.rs`. It is not clear to me whether this will return the + // statically-expected size or the dynamic size -- this is not effective in the former case. + assert_eq!(unsafe { dimensions.assume_init() }.dims.len(), 8); let mut precision = MaybeUninit::uninit(); try_unsafe!(ie_blob_get_precision(blob, precision.as_mut_ptr()))?;