Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#2,818 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
c
Lĩnh vực
tooling

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ả

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.
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

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của DeusData/codebase-memory-mcp

Tất cả issue của DeusData/codebase-memory-mcp

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.