DataView.byteOffset and element reads succeed after buffer transfer

Aperta
#3,825 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
70/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
csharp, typescript
Ambito
backend

Direzione di ricerca

Start by running the supplied repro with SharpTS interpretation and with standalone compilation and verification, then trace how detached ArrayBuffers are handled by DataView byteOffset and element reads. Compare the results with the Node.js behavior in the issue. Done means both SharpTS runs throw TypeError for the offset and read after transfer.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

While checking #3819, I found that a detached DataView still reports its old offset and reads the old storage.

const buffer = new ArrayBuffer(4);
const view = new DataView(buffer, 1, 2);
structuredClone(buffer, { transfer: [buffer] });
try { console.log(view.byteOffset); } catch (error) { console.log(error.name); }
try { console.log(view.getUint8(0)); } catch (error) { console.log(error.name); }

Node.js v22.23.2 prints TypeError twice. SharpTS interpretation and IL-verified standalone both print 1 and 0.

Run as sharpts --no-tsconfig --noLib repro.js. For standalone, run sharpts --no-tsconfig --noLib --compile repro.js --standalone --verify -o repro.dll and dotnet repro.dll.

Lingua principale
C#
Stelle
156
Fork
4
Merge medio
14h 45m
PR unite (30g)
40

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nickna/SharpTS

Tutte le issue di nickna/SharpTS

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.