Preserve truncation errors when bounded C-string copy uses the same buffer
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Issue でリンクされている箇所である std/mem/cstr.wave の mem_copy_cstr_n から始めてください。切り詰めをどのように確認し、終端文字を書き込むかを調べ、その後、提供された再現手順を -O0 と -O2 で実行してください。完全なエイリアスと列挙されたエッジケースの回帰テストを追加してください。完了条件は、ステータスと出力バイト列が完了基準に一致することです。
索引モデルが issue の本文から書いたものです。
説明
Problem
mem_copy_cstr_n writes its terminating NUL before checking whether the source was truncated. When source and destination are identical, that write changes the byte being checked and turns truncation into a successful byte count.
Starting point: mem_copy_cstr_n.
Reproduction
Audited canonical master 7a8361d5c10ec3e66fc9fe4a5801622afb6bf631 on Linux amd64. Reproduced with the public v0.2.1-pre-beta Linux amd64 compiler (LLVM 21.1.8) and this checkout's std; the compiler/std source trees match the release. Set WAVEC to the extracted package's absolute wavec path and run commands from the repository root.
import("std::mem::cstr")::{mem_copy_cstr_n};
fun main() -> i32 {
var buf: array<u8, 6> = [97, 98, 99, 100, 101, 0];
var result: i64 = mem_copy_cstr_n(&buf[0], 3, &buf[0] as str);
println("result={} bytes={} {} {}", result, buf[0], buf[1], buf[2]);
return 0;
}
Run "$WAVEC" --std-root "$PWD/std" -O0 run repro.wave, then repeat at -O2. Observed: result=2 bytes=97 98 0. The original five-byte string does not fit; the return must report MEM_ERR_NO_SPACE (-4097), as the non-aliasing copy does.
Scope
Preserve the existing bounded-prefix/NUL behavior and error constants. Cover exact source/destination identity; this issue does not require adding general memmove semantics for every partial overlap. Difficulty: easy.
Completion criteria
- Exact-alias truncation reports no-space before the original source information is lost.
- Exact fit, capacity one, empty source, and separate-source copies retain their results.
- O0/O2 regressions check both output bytes and status.
- 主要言語
- Rust
- スター
- 56
- フォーク
- 21
- 平均マージ
- 4時間 49分
- マージ済み PR(30日)
- 59
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
wavefnd/Wave のほかの issue
-
bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
Distinguish Rust character literals from lifetimes in the spacing helper対応中かも @hiyouwhatsapp が 3 日前に担当しました。 オープンbug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue needs testing
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue needs testing
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
enhancement good first issue needs testing
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
似ている issue
-
state:triage-needed
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
bug P2
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
pedrovgs/UseCaseCoverage#23 ·
-
area: library data-loss tier: p0 type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信