From 12fbb61fada325747dd132c3880a6cd7e51f1b0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Sat, 12 Sep 2026 02:17:55 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=90=E5=88=B6=E5=88=86=E7=A6=BB=E6=81=A2?= =?UTF-8?q?=E5=A4=8D=E7=8A=B6=E6=80=81=E5=86=99=E5=85=A5=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 写盘前校验与读取一致的八兆字节上限 超限时记录原因并拒绝不可恢复检查点 --- .../src/ui_editor/commands/separation/persistence.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/persistence.rs b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/persistence.rs index 5b663c609..a2f0728c4 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/persistence.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/ui_editor/commands/separation/persistence.rs @@ -66,6 +66,17 @@ fn write_separation_state_blocking(path: &Path, state: &SeparationState) -> Resu app_log!("ui_separation.error stage=state_write reason=serialize error={error}"); format!("序列化 separation state 失败:{error}") })?; + if bytes.len() > SEPARATION_STATE_MAX_BYTES { + app_log!( + "ui_separation.error stage=state_write reason=too_large bytes={} max_bytes={}", + bytes.len(), + SEPARATION_STATE_MAX_BYTES + ); + return Err(format!( + "separation state 超过 {} 字节上限", + SEPARATION_STATE_MAX_BYTES + )); + } let parent = path.parent().ok_or_else(|| { app_log!("ui_separation.error stage=state_write reason=missing_parent"); "separation state 路径缺少父目录".to_string()