core: long non-bracket chains crash the oxc-parser process in checkMod
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/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ệ
- node.js, typescript
Hướng nghiên cứu
Start with packages/core/src/mod-check.ts and its test, then reproduce the four listed source shapes in child processes using oxc-parser at the default stack size. The acceptance criteria require checkMod to return a ModCheckResult for each shape at n = 10000 and a regression test that fails before the fix. Run the existing tests and pnpm mod:check; the goldens should remain unchanged.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
checkMod in packages/core/src/mod-check.ts still takes the whole Node process down (segmentation fault inside oxc-parser's parseSync) on sources that nest deeply without brackets, and that stay under the 65536-character length guard. The bracket-depth guard added for #135 does not see them.
Steps to reproduce
- Build core (
pnpm build). - For each shape below, call
parseSync("x.ts", code, { sourceType: "module" })fromoxc-parserin its own child process, at the default 8 MB stack, and print the exit code:"export const s = " + "a=".repeat(n) + "1;""export const s = " + "a?b:".repeat(n) + "c;""export const s = " + "a=>".repeat(n) + "1;""if(a)".repeat(n) + ";""export const s = " + 'f(")"+'.repeat(n) + "1" + ")".repeat(n) + ";"(n = 5000, about 35 KB): each)inside a string cancels the(before it for the bracket-depth scan of #135, so the scan sees depth 1 while the parser nests 5000 calls; exit 139"export const s = " + "[/*]*/".repeat(n) + "]".repeat(n) + ";"(n = 8000): a closer inside a comment cancels the real opener for the bracket-depth scan of #135; exit 139"export const s = " + "[/]/,".repeat(n) + "]".repeat(n) + ";"(n = 8000): the same through a regex literal; exit 139
Expected behavior
A parse result, or an error that checkMod can turn into an issue.
Actual behavior
n = 5000: exit 0 for all four shapes
n = 10000: exit 139 (segmentation fault) for all four shapes
n = 20000: exit 139 for all four shapes
"!".repeat(n) + "x" parsed without a crash up to n = 20000. At n = 10000 the sources are 20000 to 50000 characters, so they pass the length guard. The crash was not measured at a 1 MB stack for these shapes.
Notes
Seen on Linux with oxc-parser 0.160.0. A real built mod is up to about 42 KB (jevfort hooks/register.js), so no length limit separates real mods from these inputs, and a pre-parse scan for each construct would be a growing list of heuristics. The decision is for a maintainer: parse out of process or on a larger stack, or have it fixed upstream in oxc-parser.
The bracket-depth scan added in #135 counts brackets inside strings, comments and regexes, so it miscounts in both directions (it can reject a valid source and miss real nesting) and it cannot be switched off.
Scope
core (packages/core/src/mod-check.ts and its test). Changeset: patch for @kwitsch/claude-code-plugin-core.
Acceptance
checkModon each of the four shapes at n = 10000 returns aModCheckResultwithout killing the process (the run is in a child process in the test).- A regression test covers the four shapes and fails before the fix.
- Existing tests and
pnpm mod:checkpass with the goldens unchanged.
Relations
- Originating branch: fix/issue-135-nested-source-crash
- Ngôn ngữ chính
- TypeScript
- Star
- 0
- Fork
- 0
- Merge trung bình
- 29 phút
- Pull request đã merge (30 ngày)
- 138
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
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 kwitsch/claude-code-plugin-tooling
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
kwitsch/claude-code-plugin-tooling#219 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 69/100
kwitsch/claude-code-plugin-tooling#210 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 54/100
kwitsch/claude-code-plugin-tooling#212 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
kwitsch/claude-code-plugin-tooling#209 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
kwitsch/claude-code-plugin-tooling#208 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của kwitsch/claude-code-plugin-tooling
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
makecindy/cindy#15342 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
no-repo-link tool-submission
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 74/100
BraveOPotato/NoSignups#2618 ·
-
enhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
-
bug needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Priyanshu-byte-coder/devtrack#4067 ·
Maintainer thường phản hồi trong vòng 1 ngày