Index worker segfaults on PlantUML edge messages: dg_puml_operand leaves *id uninitialized
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 70/100
Hướng nghiên cứu
Bắt đầu trong internal/cbm/diagram.c tại dg_puml_operand (dòng 1229), nơi *label được gán nhưng *id chỉ được ghi trên các nhánh thành công; kiểm tra dg_str_t lid/rid chưa được khởi tạo của các caller relation (dòng 1310, 1343) và các caller của dg_puml_decl (1430, 1435). Chạy script tái hiện và codebase-memory-mcp cli index_repository để xác nhận skipped_count là 1 trước thay đổi và 0 sau đó. Hoàn tất nghĩa là Alice ->: x, Alice <-: x và [-> Alice: x đều được index mà không bị quarantine, kể cả biến thể !include.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C
- Star
- 45.8k
- Fork
- 3.8k
- Merge trung bình
- 3 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 210
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của DeusData/codebase-memory-mcp
-
Generated Pi extension (cbmem.ts) breaks Gemini/Antigravity: Type.Union of Type.Literal serializes to anyOf/constCó thể đã có người làm @divakantpandey đã nhận 2 ngày trước. Đang mởbug editor/integration
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
DeusData/codebase-memory-mcp#2787 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
editor/integration parsing/quality
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
DeusData/codebase-memory-mcp#2286 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
install writes an unsupported `args` key into the Claude Code SubagentStart hook, so it never runsĐang mởbug editor/integration priority/high stability/performance ux/behavior
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
DeusData/codebase-memory-mcp#2239 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug priority/high ux/behavior
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
DeusData/codebase-memory-mcp#2232 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
documentation editor/integration parsing/quality priority/normal
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
DeusData/codebase-memory-mcp#2169 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của DeusData/codebase-memory-mcp
Issue tương tự
-
docs, ffi, python: update stale "built-in rules" references and pipeline order in docstringsĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[cmocka] update to 2.0.2Đang mởupdate-request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
msys2/MINGW-packages#33004 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
docs: write the buffer exampleĐang mởarea:buffer good first issue type:documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
sudo-project/sudo#586 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
OpenPrinting/cups#1795 ·
Maintainer thường phản hồi trong vòng 1 ngày