fix: guard FFI request intercept output pointers#284
Conversation
Signed-off-by: Minh Vu <vuhoangminh97@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Enterprise Run ID: 📒 Files selected for processing (2)
📜 Recent review details🧰 Additional context used📓 Path-based instructions (14)crates/ffi/src/api/**/*.rs📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)
Files:
**/*.rs📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)
Files:
**/{Cargo.toml,**/*.rs}📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)
Files:
**/*.{h,hpp,c,cpp,rs}📄 CodeRabbit inference engine (.agents/skills/maintain-packaging/SKILL.md)
Files:
**/*.{rs,toml}📄 CodeRabbit inference engine (.agents/skills/rename-surfaces/SKILL.md)
Files:
crates/ffi/**📄 CodeRabbit inference engine (.agents/skills/test-ffi-surface/SKILL.md)
Files:
crates/ffi/**/*.rs📄 CodeRabbit inference engine (.agents/skills/test-go-binding/SKILL.md)
Files:
**/*.{rs,py,js,ts,tsx,jsx,go,sh,toml,yaml,yml,md}📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/*.{rs,py,go,js,ts,tsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
crates/**/*.rs📄 CodeRabbit inference engine (AGENTS.md)
Files:
crates/{python,ffi,node,wasm}/**/*⚙️ CodeRabbit configuration file
Files:
**⚙️ CodeRabbit configuration file
Files:
{crates/adaptive/**/*.rs,**/*test*.{rs,py,go,ts,js},**/*adaptive*test*.{rs,py,go,ts,js},docs/plugins/adaptive/**}📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)
Files:
{crates/**/tests/**,python/tests/**,go/nemo_relay/**/*_test.go}⚙️ CodeRabbit configuration file
Files:
🔇 Additional comments (2)
WalkthroughAdds null out-pointer checks to ChangesNull out-pointer guard for FFI intercept functions
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Overview
The standalone FFI request intercept helpers now validate their output pointer before writing through it, so invalid C ABI callers receive
NemoRelayStatus::NullPointerinstead of crashing the process.Details
out.is_null()checks tonemo_relay_tool_request_interceptsandnemo_relay_llm_request_intercepts.out pointer is nullbefore returningNemoRelayStatus::NullPointer.*outto null on non-null output pointers before parsing or middleware execution, so later error paths do not leave stale output pointers.Validation:
cargo test -p nemo-relay-ffi test_ffi_helper_rejection_and_null_name_paths -- --nocapturecargo test -p nemo-relay-fficargo fmt --all --checkgit diff --checkjust test-rustWhere should the reviewer start?
Start with
crates/ffi/src/api/mod.rs, then checkcrates/ffi/tests/unit/api/registry_tests.rsfor the null pointer coverage.Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
Summary by CodeRabbit
Bug Fixes
Tests