🟡 P1 | ffi_zx_document_ffi_rustbuffer_from_bytes_separate 未检查 call status #39

Closed
opened 2026-06-06 12:33:02 +08:00 by wangdl · 1 comment
Owner

背景

from_bytes_separate 创建了 RustCallStatus 但从未检查返回值。Rust 侧内存分配失败时 out_capacity/out_len 将为未初始化的栈垃圾值。

修复方案

调用后检查 call_status.code,若不为 SUCCESS 则设置 out 参数为 0/NULL 并返回错误。

位置

crates/zx_document_ffi/src/lib.rs:160-166

## 背景 from_bytes_separate 创建了 RustCallStatus 但从未检查返回值。Rust 侧内存分配失败时 out_capacity/out_len 将为未初始化的栈垃圾值。 ## 修复方案 调用后检查 call_status.code,若不为 SUCCESS 则设置 out 参数为 0/NULL 并返回错误。 ## 位置 crates/zx_document_ffi/src/lib.rs:160-166
wangdl added this to the M6:Code Review 质量完善(2026-06-06) milestone 2026-06-06 12:33:02 +08:00
Author
Owner

修复完成 (2026-06-06)

实现

  • from_bytes_separate 调用后检查 call_status.code 是否为 Success
  • 非成功时 out 三个指针置 0/NULL 并 return

状态

已修复,已推送。

## 修复完成 (2026-06-06) ### 实现 - `from_bytes_separate` 调用后检查 `call_status.code` 是否为 `Success` - 非成功时 out 三个指针置 0/NULL 并 return ### 状态 ✅ 已修复,已推送。
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: wangdl/zhixi-document-runtime#39
No description provided.