From d5239a0d91f3f40190f3dec24d9d0a0f17b96a06 Mon Sep 17 00:00:00 2001 From: Robert Edmonds Date: Wed, 19 Feb 2025 18:06:07 -0500 Subject: [PATCH] Fix Array::resize_raw() to allow resizing to the length of the array. The `new_len` parameter to Array::resize_raw() is the new length of the contained octets sequence. The documentation for resize_raw() specifies that it is an error for `new_len` to be larger than the array size, but the current code also returns an error if `new_len` is equal to the array size. --- src/array.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/array.rs b/src/array.rs index 31115eb..a73a902 100644 --- a/src/array.rs +++ b/src/array.rs @@ -42,7 +42,7 @@ impl Array { /// /// Returns an error if `new_len` is larger than the array size. pub fn resize_raw(&mut self, new_len: usize) -> Result<(), ShortBuf> { - if new_len >= N { + if new_len > N { Err(ShortBuf) } else {