Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

fix(config): drop the fuzz-link and Cypher hunks from the worktree change

Martin Vogelfaf25ee4fa6a
diff --git a/Makefile.cbm b/Makefile.cbm
index b2a655505..ab5c89db7 100644
--- a/Makefile.cbm
+++ b/Makefile.cbm
@@ -1381,10 +1381,10 @@ fuzz:
CC=$(FUZZ_CC) CXX=$(FUZZ_CXX) SANITIZE="$(FUZZ_SANITIZE)"
$(BUILD_DIR)/cbm-fuzz: $(FUZZ_SRC) $(PROD_SRCS) $(EXTRACTION_SRCS) $(AC_LZ4_SRCS) $(ZSTD_SRCS) $(SQLITE_WRITER_SRC) $(OBJS_VENDORED_TEST) $(PROJECT_HDRS) | $(BUILD_DIR)
- $(CXX) $(CFLAGS_TEST) -x c -fsanitize=fuzzer -o $@ \
+ $(CC) $(CFLAGS_TEST) -fsanitize=fuzzer -o $@ \
$(FUZZ_SRC) $(PROD_SRCS) \
$(EXTRACTION_SRCS) $(AC_LZ4_SRCS) $(ZSTD_SRCS) $(SQLITE_WRITER_SRC) \
- -x none $(OBJS_VENDORED_TEST) \
+ $(OBJS_VENDORED_TEST) \
$(LDFLAGS_TEST)
# Path-sensitive memory analysis: leak paths, null derefs, uninitialized reads.
diff --git a/src/cypher/cypher.c b/src/cypher/cypher.c
index 42ecb93c5..7c7a2f987 100644
--- a/src/cypher/cypher.c
+++ b/src/cypher/cypher.c
@@ -1862,8 +1862,6 @@ static int parse_return(parser_t *p, cbm_return_clause_t **out) {
return parse_return_or_with(p, out, false);
}
-static void free_pattern(cbm_pattern_t *pat);
-
/* Parse a single MATCH pattern into pat */
static int parse_match_pattern(parser_t *p, cbm_pattern_t *pat) {
memset(pat, 0, sizeof(*pat));
@@ -1872,38 +1870,31 @@ static int parse_match_pattern(parser_t *p, cbm_pattern_t *pat) {
pat->nodes = malloc(node_cap * sizeof(cbm_node_pattern_t));
pat->rels = calloc(rel_cap, sizeof(cbm_rel_pattern_t));
- /* Count the slot before parsing so even partially filled nodes and
- * relationships are released when a malformed pattern is rejected. */
- pat->node_count = SKIP_ONE;
if (parse_node(p, &pat->nodes[0]) < 0) {
- goto fail;
+ return CBM_NOT_FOUND;
}
+ pat->node_count = SKIP_ONE;
while (check(p, TOK_DASH) || check(p, TOK_LT)) {
if (pat->rel_count >= rel_cap) {
rel_cap *= PAIR_LEN;
pat->rels = safe_realloc(pat->rels, rel_cap * sizeof(cbm_rel_pattern_t));
}
- pat->rel_count++;
- if (parse_rel(p, &pat->rels[pat->rel_count - SKIP_ONE]) < 0) {
- goto fail;
+ if (parse_rel(p, &pat->rels[pat->rel_count]) < 0) {
+ return CBM_NOT_FOUND;
}
+ pat->rel_count++;
if (pat->node_count >= node_cap) {
node_cap *= PAIR_LEN;
pat->nodes = safe_realloc(pat->nodes, node_cap * sizeof(cbm_node_pattern_t));
}
- pat->node_count++;
- if (parse_node(p, &pat->nodes[pat->node_count - SKIP_ONE]) < 0) {
- goto fail;
+ if (parse_node(p, &pat->nodes[pat->node_count]) < 0) {
+ return CBM_NOT_FOUND;
}
+ pat->node_count++;
}
return 0;
-
-fail:
- free_pattern(pat);
- memset(pat, 0, sizeof(*pat));
- return CBM_NOT_FOUND;
}
/* Parse UNWIND [...] AS var clause into query */
diff --git a/tests/test_cypher.c b/tests/test_cypher.c
index 5d198a0ef..7c251bd9b 100644
--- a/tests/test_cypher.c
+++ b/tests/test_cypher.c
@@ -274,24 +274,6 @@ TEST(cypher_parse_accepts_single_with_clause) {
PASS();
}
-TEST(cypher_parse_rejects_partial_patterns) {
- const char *queries[] = {
- "MATCH p = (a:Class)-[:INHERITS*1..3]->(b:Class) RETURN a.name, length(p)",
- "MATCH (a)-[:CALLS]->(b) MATCH (c)-[:CALLS*]-> RETURN a.name",
- "MATCH (a)-[:CALLS|]->(b)",
- };
- for (size_t i = 0; i < sizeof(queries) / sizeof(queries[0]); i++) {
- cbm_query_t *q = NULL;
- char *err = NULL;
- int rc = cbm_cypher_parse(queries[i], &q, &err);
- ASSERT_NEQ(rc, 0);
- ASSERT_NULL(q);
- ASSERT_NOT_NULL(err);
- free(err);
- }
- PASS();
-}
-
TEST(cypher_parse_relationship_outbound) {
cbm_query_t *q = NULL;
char *err = NULL;
@@ -4860,7 +4842,6 @@ SUITE(cypher) {
RUN_TEST(cypher_parse_rejects_trailing_tokens);
RUN_TEST(cypher_parse_rejects_second_with_clause);
RUN_TEST(cypher_parse_accepts_single_with_clause);
- RUN_TEST(cypher_parse_rejects_partial_patterns);
RUN_TEST(cypher_parse_relationship_outbound);
RUN_TEST(cypher_parse_relationship_inbound);
RUN_TEST(cypher_parse_relationship_any);