message: Add memory validation
diff: @@ -73,6 +73,12 @@ impl Memory {
  }
  }
  + if desc.shared && desc.maximum.is_none() {
  + return Err(CreationError::InvalidDescriptor(
  + "Max number of pages is required for shared memory".to_string(),
  + ));
  + }
  +
  let variant = if !desc.shared {
  MemoryVariant::Unshared(UnsharedMemory::new(desc)?)
  } else {
  @@ -325,4 +331,17 @@ mod memory_tests {
  assert_eq!(unshared_memory.size(), Pages(10));
  }
  + #[test]
  + fn test_invalid_descriptor_returns_error() {
  + let result = Memory::new(MemoryDescriptor {
  + minimum: Pages(10),
  + maximum: None,
  + shared: true,
  + });
  + assert!(
  + result.is_err(),
  + "Max number of pages is required for shared memory"
  + )
  + }
  +
  }
  