%TypedArray%.prototype.with converts its arguments before checking for a detached buffer
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 56/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- c, javascript
- Ambito
- backend
Direzione di ricerca
The report identifies %TypedArray%.prototype.with but does not name implementation or test files. Start by locating that method and its existing detached-buffer checks, then find the related tests for typed-array methods and run them. Done means the detached-buffer TypeError occurs before either argument's conversion, including when valueOf throws.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Reproduction
const b = new ArrayBuffer(8);
const v = new Int32Array(b);
b.transfer();
v.with(0, { valueOf() { throw 0; } });
Expected
A TypeError is thrown for the detached buffer, and valueOf is never called.
V8 (15.6.20):
$ v8 -e 'const b = new ArrayBuffer(8); const v = new Int32Array(b); b.transfer(); v.with(0, { valueOf() { throw 0; } });'
TypeError: Cannot perform %TypedArray%.prototype.with on a detached or out-of-bounds ArrayBuffer
Actual (QuickJS-ng)
QuickJS-ng converts the value first, so the 0 it throws propagates:
$ qjs -e 'const b = new ArrayBuffer(8); const v = new Int32Array(b); b.transfer(); v.with(0, { valueOf() { throw 0; } });'
0
Spec
%TypedArray%.prototype.with begins with ValidateTypedArray, which throws a TypeError when IsTypedArrayOutOfBounds is true. A view on a detached buffer is out of bounds, so the method must throw before it converts index with ToIntegerOrInfinity or value with ToNumber.
QuickJS-ng has the detached check, but only after both conversions: v.with(0, 1) throws TypeError: ArrayBuffer is detached or resized, and a throwing valueOf on the index (v.with({ valueOf() { throw 0; } }, 1)) also runs before it.
This is not what #1625 was about. PR #1667 changed which conversion is applied to value relative to the index check; the missing step here is the ValidateTypedArray that precedes both.
JavaScriptCore, SpiderMonkey, GraalJS and V8 all throw the TypeError.
Versions
- QuickJS-ng: 0.17.0
- V8: 15.6.20
- Lingua principale
- C
- Stelle
- 3.9k
- Fork
- 389
- Merge medio
- 4g 1h
- PR unite (30g)
- 24
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 quickjs-ng/quickjs
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
quickjs-ng/quickjs#1836 ·
I maintainer di solito rispondono entro 2 giorni
-
Array.prototype.find frees an element twice when interrupted between iterationsForse già presa @josefguenther l’ha presa 13 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
quickjs-ng/quickjs#1792 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
Object.prototype.propertyIsEnumerable converts `this` before the property keyForse già presa @SomSamantray l’ha presa 9 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
quickjs-ng/quickjs#1772 ·
I maintainer di solito rispondono entro 2 giorni
-
Deserialization corrupts data or returns `undefined` when a RegExp precedes a shared object referenceForse già presa @Sree24-ui l’ha presa 13 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
quickjs-ng/quickjs#1771 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
quickjs-ng/quickjs#1835 · 1 reazione ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di quickjs-ng/quickjs
Issue simili
-
Mark ignored Mac OS partitions RecoveryOSContainer and iBootSystemContainerForse già presa @meven l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
storaged-project/udisks#1559 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 71/100
awslabs/aws-checksums#121 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 3 giorni
-
Bad tag for language cardAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100