%TypedArray%.from reads its source before checking that this is a constructor
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- c, javascript
- Ambito
- compilers
Direzione di ricerca
Start by locating QuickJS-ng’s implementation of %TypedArray%.from and any existing tests for typed-array built-ins; the issue does not name files or test paths. Compare the operation order with the spec steps cited in the report. Done when an invalid this value throws TypeError before accessing the source iterator or length, with regression tests covering both cases.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Reproduction
Uint8Array.from.call({}, { get [Symbol.iterator]() { throw 0; } });
Expected
A TypeError, because {} is not a constructor. The getter is never called.
V8 (15.6.20):
$ v8 -e 'Uint8Array.from.call({}, { get [Symbol.iterator]() { throw 0; } });'
TypeError: #<Object> is not a constructor
Actual (QuickJS-ng)
$ qjs -e 'Uint8Array.from.call({}, { get [Symbol.iterator]() { throw 0; } });'
0
Spec
The first steps of %TypedArray%.from are "Let ctor be the this value. If IsConstructor(ctor) is false, throw a TypeError exception." Only after that does it look at mapper and call GetMethod(source, %Symbol.iterator%).
QuickJS-ng checks the constructor only when it creates the result, after the whole source has been consumed. So the iterator is run to completion first, and the array-like length is read first, before the TypeError:
$ qjs -e 'Uint8Array.from.call({}, (function* () { print("next"); yield 1; })());'
next
TypeError: not a constructor # V8: TypeError only, "next" is never printed
$ qjs -e 'Uint8Array.from.call({}, { get length() { throw 0; } });'
0 # V8: TypeError: #<Object> is not a constructor
%TypedArray%.of is unaffected: it has no source to read before the check.
JavaScriptCore, SpiderMonkey, GraalJS, XS and V8 all throw the TypeError without calling the getter.
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 15 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 11 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 15 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
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
linux-test-project/ltp#1343 · 1 commento ·
-
test_audio_host: out-of-bounds read in test_audio_host_uses_exponential_full_speed_iso_intervalApertafollowup Prio 📌
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
docs
Difficoltà 2/5 1-3 ore Idoneità per principianti 69/100
micropython/micropython#19798 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100