Prevent compiler stack overflow on long acyclic forward type-alias chains
Maintainer thường phản hồi trong vòng 1 ngà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
- 35/100
Hướng nghiên cứu
Start with the type canonicalization code in front/parser/src/verification/program.rs and the alias graph validation paths it reaches. Run the Python reproduction from the issue against target/debug/wavec to get the SIGABRT, then find which recursive function first exhausts the stack. Done means the 16384-alias chain completes or returns a normal diagnostic, direct and indirect alias cycles still get rejected, and tests cover forward and backward declaration order.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
A long acyclic chain of forward type aliases aborts wavec check with a stack overflow instead of completing or returning a normal source diagnostic. Each declaration contains only a shallow named type, so the syntactic type-depth guard does not bound semantic traversal through the alias graph.
This is a Wave compiler robustness defect. It is not evidence of a Rust standard-library or compiler vulnerability.
Starting points: type canonicalization and the alias graph validation paths. The end-to-end abort is confirmed; the exact recursive function that first exhausts the stack has not been isolated.
Reproduction
Tested on Linux amd64 with a checkout-built wavec 0.0.1-alpha-dev, Rust 1.89.0 and LLVM 21. Local revision f7ff92c54bf8b41c2877245788890935b4ca3ba1; the frontend and driver source are identical to canonical master 1d1751405e087f32c1b1f28399d1629ae1bcfbd2 for this reproduction.
Run from the checkout. This creates only a temporary source, disables core dumps in the child and bounds the compiler invocation:
from pathlib import Path
import resource
import subprocess
import tempfile
compiler = str(Path('target/debug/wavec').resolve())
def limits():
resource.setrlimit(resource.RLIMIT_CORE, (0, 0))
with tempfile.TemporaryDirectory() as temporary:
source = Path(temporary) / 'aliases.wave'
count = 16384
source.write_text(
'\n'.join(f'type A{i} = A{i + 1};' for i in range(count - 1))
+ f'\ntype A{count - 1} = i32;\n'
+ 'fun main() { var x: A0 = 0; }\n',
encoding='utf-8',
)
result = subprocess.run(
[compiler, 'check', str(source), '--error-format=json'],
capture_output=True, text=True, timeout=12, preexec_fn=limits,
)
print(result.returncode)
print(result.stderr)
Observed exit -6 (SIGABRT):
thread 'main' has overflowed its stack
fatal runtime error: stack overflow, aborting
The host-dependent failure threshold is not a proposed language limit. Separate 4096- and 8192-alias probes exceeded the 12-second observation window; that does not establish an asymptotic complexity claim.
Scope
Make semantic alias traversal safe for long acyclic graphs while preserving supported forward aliases and existing recursive-alias rejection. Preserve normal structured and JSON diagnostics. Do not increase the OS stack size or silently replace unresolved types.
Related: #167 rejects cycles; #852 bounds syntactic block/type nesting; #1029 bounds import depth. None covers this shallow, acyclic alias graph.
Completion criteria
- A long acyclic forward alias chain no longer aborts the compiler.
- Direct and indirect cycles still receive normal diagnostics.
- Tests cover forward/backward declaration order and aliases used by ordinary type checking and code generation.
- Any newly proposed rejection limit is discussed before changing accepted-language semantics.
- Ngôn ngữ chính
- Rust
- Star
- 56
- Fork
- 21
- Merge trung bình
- 20 giờ 49 phút
- Pull request đã merge (30 ngày)
- 45
Chuẩn bị môi trường
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 wavefnd/Wave
-
Reject unrepresentable POSIX listener descriptors before Unix-domain acceptCó thể đã có người làm @ShahadatTest đã nhận 2 ngày trước. Đang mởbug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
wavefnd/Wave#1082 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug help wanted
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug help wanted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 53/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug build help wanted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 56/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug ci help wanted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
apache/datafusion-iceberg#100 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: cua-driver skill fails Agent Skills frontmatter validationCó thể đã có người làm @Mearman đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area/tools bug session-analysis
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/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 80/100
oracle/rust-oracledb#66 ·
-
`PrimitiveArray::validate_decimal_precision` rejects every decimal array with a negative scaleĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày