From 32f81d37673871172e64ec4335e0820f1f8469a1 Mon Sep 17 00:00:00 2001 From: zhiqiangxu <652732310@qq.com> Date: Tue, 9 Apr 2024 14:42:30 +0800 Subject: [PATCH] fix stack overflow --- src/fs.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fs.rs b/src/fs.rs index f886cf5..f997f4f 100644 --- a/src/fs.rs +++ b/src/fs.rs @@ -306,7 +306,7 @@ impl StorageBackend for MemoryBackend { pub struct WriteBuffer<'file, const SIZE: usize> { file: &'file Box, - buffer: [u8; SIZE], + buffer: Box<[u8; SIZE]>, len: usize, file_len: u64, } @@ -315,7 +315,7 @@ impl<'file, const SIZE: usize> WriteBuffer<'file, SIZE> { pub(crate) fn new(file: &'file Box, file_len: u64) -> Self { Self { file, - buffer: [0u8; SIZE], + buffer: [0u8; SIZE].into(), len: 0, file_len, }