Code graph and memory for your coding agents, in one Rust program. For Claude Code, Codex, Cursor and any MCP client.
Rust agent-memoryai-agentsclaude-codecode-analysiscode-graphcode-intelligencecode-searchcodexcoding-agentscontext-engineeringcursordeveloper-toolsgraphragknowledge-graphlocal-firstmcpmcp-servermodel-context-protocolrusttree-sitter
fix: leave out a document whose converted text carries a NUL byte
Ryan Kuhl30e3111faa81
diff --git a/crates/graphicle/src/documents.rs b/crates/graphicle/src/documents.rsindex db4ace2..a711ca2 100644--- a/crates/graphicle/src/documents.rs+++ b/crates/graphicle/src/documents.rs@@ -96,6 +96,10 @@ fn bounded(text: String) -> Result<String> {"No readable text was extracted; OCR may be required",));}+ // A converter emits a NUL for a glyph with no Unicode mapping; the store refuses text with one.+ if text.contains('\0') {+ return Err(Error::bad("Extracted text contains a NUL character"));+ }Ok(text)}pub fn xml_text(bytes: &[u8]) -> Result<String> {@@ -712,3 +716,14 @@ impl Store {})}}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn extracted_text_with_a_nul_is_refused() {+ let error = bounded("before\u{0}after".to_string()).unwrap_err();+ assert!(error.message.contains("NUL"), "{error:?}");+ }+}