Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Preserve truncation errors when bounded C-string copy uses the same buffer

オープン 初心者向け
#854 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
backend

調査の方向性

Issue でリンクされている箇所である std/mem/cstr.wave の mem_copy_cstr_n から始めてください。切り詰めをどのように確認し、終端文字を書き込むかを調べ、その後、提供された再現手順を -O0 と -O2 で実行してください。完全なエイリアスと列挙されたエッジケースの回帰テストを追加してください。完了条件は、ステータスと出力バイト列が完了基準に一致することです。

索引モデルが issue の本文から書いたものです。

説明

bug good first 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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

wavefnd/Wave のほかの issue

wavefnd/Wave の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。