Index worker segfaults on PlantUML edge messages: dg_puml_operand leaves *id uninitialized
メンテナーはふだん 2 日以内に返信
@nefayran がすでに取り組んでいます。
2026年10月29日 から。
評価
調査の方向性
internal/cbm/diagram.c の dg_puml_operand(1229 行目)から始めます。ここでは *label は設定されますが、*id は成功パスでのみ書き込まれます。relation の呼び出し元の未初期化の dg_str_t lid/rid(1310、1343 行目)と dg_puml_decl の呼び出し元(1430、1435 行目)を確認してください。再現スクリプトと codebase-memory-mcp cli index_repository を実行し、変更前に skipped_count が 1、変更後に 0 であることを確認してください。完了とは、Alice ->: x、Alice <-: x、[-> Alice: x がすべて隔離なしでインデックスされ、!include のバリアントも含まれることです。
索引モデルが issue の本文から書いたものです。
説明
Version
0.12.1 (Nix flake build of 8530c8cd1c1ac8e1e3d2962bc213a8c9025fea0a, --version prints dev)
Platform
Linux (x64)
Install channel
Built from source
Binary variant
standard
What happened, and what did you expect?
Written with Claude Code (AI agent) on my behalf.
The index worker segfaults on a PlantUML sequence message to or from the diagram edge (A ->: x, A <-: x, [-> A: x), and the file is quarantined. Expected: the file indexes, and the edge message is skipped or kept as a message without a participant.
Cause, from internal/cbm/diagram.c (unchanged between 8530c8cd and main at 83109dde):
dg_puml_operand(line 1229) sets*labelup front but*idonly on its success paths. In the opener branch ([,(,:,"), an unmatched closer hitsif (!c) { return i; }(line 1242) and leaves*idunwritten.dg_puml_relationdeclaresdg_str_t lid;(line 1310) anddg_str_t rid;(line 1343) without initializers, soif (!lid.n)/if (!rid.n)test stack garbage, and the garbage reachesdg_element->dg_trim.Alice ->: x: the right operand starts at:with no second:.[-> Alice: x: the left operand starts at[with no].
Since this is an uninitialized read, whether a file crashes depends on what earlier lines left on the stack. In my build the !include line is what makes it crash: the same file without it indexes cleanly. dg_puml_decl (lines 1430, 1435) calls the same helper with uninitialized id / aid. I have not reproduced a crash through that path.
Possible fix: initialize *id = dg_s(NULL, 0); next to *label at the top of dg_puml_operand. The relation callers then take their existing !lid.n / !rid.n early returns. I have not built or tested this patch.
Impact: on a large repo with many such diagrams, each crash restarts the full index through the daemon recovery loop. Suspect attribution quarantined unrelated files (.sql, .md, .go) before it reached the diagram, and with auto_watch on, every git change starts the loop again. Workaround: *.puml in .cbmignore.
Reproduction
- Code (dummy snippet):
mkdir repro && cd repro && git init -q
printf '@startuml\nparticipant Alice\n@enduml\n' > header.puml
printf '@startuml\n!include header.puml\nAlice ->: x\n@enduml\n' > repro.puml
git add . && git commit -qm init
- Command:
codebase-memory-mcp cli index_repository "{\"repo_path\":\"$PWD\"}" - Result:
"skipped_count":1, andrepro.pumlis reported asquarantined after crash.Alice <-: xand[-> Alice: xin place ofAlice ->: xcrash the same way. Expected:"skipped_count":0.
Logs
Backtrace from the worker core dump (release build, no debug info):
Program terminated with signal SIGSEGV, Segmentation fault.
#0 dg_trim ()
#1 dg_element ()
#2 dg_puml_relation.isra ()
#3 dg_build ()
#4 cbm_extract_diagram_file ()
#5 cbm_extract_file_ex_with_tests ()
#6 cbm_pipeline_pass_definitions ()
#7 run_sequential_pipeline ()
#8 cbm_pipeline_run_staged ()
#9 cbm_pipeline_run ()
#10 handle_index_repository ()
Diagnostics trajectory (memory / performance / leak issues)
Project scale (if relevant)
No response
Confirmations
- I searched existing issues and this is not a duplicate.
- My reproduction uses shareable code (a dummy snippet or a public OSS repository), not proprietary code.
- 主要言語
- C
- スター
- 45.8k
- フォーク
- 3.8k
- 平均マージ
- 3日 11時間
- マージ済み PR(30日)
- 201
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DeusData/codebase-memory-mcp のほかの issue
-
editor/integration parsing/quality
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
DeusData/codebase-memory-mcp#2286 ·
メンテナーはふだん 2 日以内に返信
-
install writes an unsupported `args` key into the Claude Code SubagentStart hook, so it never runsオープンbug editor/integration priority/high stability/performance ux/behavior
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
DeusData/codebase-memory-mcp#2239 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
bug priority/high ux/behavior
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
DeusData/codebase-memory-mcp#2232 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
-
documentation editor/integration parsing/quality priority/normal
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
DeusData/codebase-memory-mcp#2169 ·
メンテナーはふだん 2 日以内に返信
-
documentation priority/normal ux/behavior
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
DeusData/codebase-memory-mcp#2050 ·
メンテナーはふだん 2 日以内に返信
DeusData/codebase-memory-mcp の issue をすべて見る
似ている issue
-
Type: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
apache/nuttx-apps#3942 ·
メンテナーはふだん 1 日以内に返信
-
Add missing unit tests for IsAdmissionPolicyName and IsCertManagerResourceName対応中かも @a1h8 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
kubernetes-sigs/security-profiles-operator#3644 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 70/100
ly05010419/MacNativeGames#1340 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信