Preserve truncation errors when bounded C-string copy uses the same buffer
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 82/100
Direzione di ricerca
Inizia da std/mem/cstr.wave in mem_copy_cstr_n, la posizione collegata nell’issue. Esamina come verifica il troncamento e scrive il terminatore, quindi esegui la riproduzione fornita con -O0 e -O2. Aggiungi regressioni per l’aliasing esatto e i casi limite elencati; il lavoro è terminato quando lo stato e i byte di output corrispondono ai criteri di completamento.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Rust
- Stelle
- 56
- Fork
- 21
- Merge medio
- 5h 2m
- PR unite (30g)
- 56
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di wavefnd/Wave
-
bug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Distinguish Rust character literals from lifetimes in the spacing helperForse già presa @hiyouwhatsapp l’ha presa 4 giorni fa. Apertabug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue needs testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Add checked floating-point byte readers and writersForse già presa @LunaStev l’ha presa 1 giorno fa. Apertaenhancement good first issue needs testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue needs testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di wavefnd/Wave
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
DayuanJiang/PecoFence#139 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
nearai/compose-manager#73 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
akitaonrails/ai-memory#1664 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno