Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Index worker segfaults on PlantUML edge messages: dg_puml_operand leaves *id uninitialized

オープン 初心者向け
#2,818 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

@nefayran がすでに取り組んでいます。

2026年10月29日 から。

  • #2827 @nefayran による — オープン
  • #2829 @pcristin による — マージされずにクローズ
  • #2832 @divakantpandey による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
70/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
c
領域
tooling

調査の方向性

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 の本文から書いたものです。

説明

bug editor/integration stability/performance
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 *label up front but *id only on its success paths. In the opener branch ([, (, :, "), an unmatched closer hits if (!c) { return i; } (line 1242) and leaves *id unwritten.
  • dg_puml_relation declares dg_str_t lid; (line 1310) and dg_str_t rid; (line 1343) without initializers, so if (!lid.n) / if (!rid.n) test stack garbage, and the garbage reaches dg_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
  1. 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
  1. Command: codebase-memory-mcp cli index_repository "{\"repo_path\":\"$PWD\"}"
  2. Result: "skipped_count":1, and repro.puml is reported as quarantined after crash. Alice <-: x and [-> Alice: x in place of Alice ->: x crash 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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

DeusData/codebase-memory-mcp のほかの issue

DeusData/codebase-memory-mcp の issue をすべて見る

似ている issue

C の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。