`Object.isFrozen` / `Object.isSealed` check properties before `isExtensible` and leak `props` when `JS_IsExtensible` throws
I maintainer di solito rispondono entro 5 giorni
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
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- c, javascript
Direzione di ricerca
Start in quickjs.c at js_object_isSealed around lines 42039–42073, then compare its operation order with the linked TestIntegrityLevel specification. Reproduce with the provided proxy script and ASAN build; check both Object.isFrozen and Object.isSealed. Done means extensibility is checked before property inspection and error paths release the property array, with the expected output and no reported leak.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Object.isFrozen and Object.isSealed inspect own property keys and descriptors before checking whether the object is extensible, and leak the enumerated property array (and its atom refcounts) if the extensibility check throws.
// t.js
var target = { a: 1 }, log = [];
var p = new Proxy(target, {
isExtensible(t) { log.push("isExtensible"); Object.freeze(t); return Reflect.isExtensible(t); },
ownKeys(t) { log.push("ownKeys"); return Reflect.ownKeys(t); }
});
console.log(Object.isFrozen(p), log.join(","));
var vp = new Proxy({}, {
ownKeys() { throw new TypeError("ownKeys called on extensible proxy"); }
});
try {
console.log(Object.isFrozen(vp));
} catch (e) {
console.log(e.name + ": " + e.message);
}
var lp = new Proxy(Object.freeze({ leaked_atom: 1 }), {
isExtensible() { return true; }
});
try { Object.isFrozen(lp); } catch (e) {}
Running ./qjs t.js prints:
false ownKeys
TypeError: ownKeys called on extensible proxy
With make CONFIG_ASAN=y qjs && ./qjs t.js, LeakSanitizer also reports:
Direct leak of 16 byte(s) in 1 object(s) allocated from:
...
#6 ... in JS_GetOwnPropertyNamesInternal .../quickjs.c:8972
#7 ... in js_object_isSealed .../quickjs.c:42053
Expected (Node.js v26.13.0, SpiderMonkey; TestIntegrityLevel):
true isExtensible,ownKeys
false
with no memory or atom leak (Object.isSealed behaves the same way).
In js_object_isSealed (quickjs.c:42039), JS_GetOwnPropertyNamesInternal and the descriptor loop run before JS_IsExtensible(ctx, obj), and the if (res < 0) return JS_EXCEPTION; error path at line 42073 returns without calling JS_FreePropertyEnum(ctx, props, len).
Versions: QuickJS master 2519774 (2026-11-23) and release 2026-06-04 (3d5e064), Linux x86_64.
Credit: https://ucsbplse.github.io/
- Lingua principale
- C
- Stelle
- 11.1k
- Fork
- 1.2k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
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 bellard/quickjs
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 5 giorni
-
`ArrayBuffer.prototype.transfer(n)` with n > maxByteLength throws TypeError instead of RangeErrorAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 69/100
I maintainer di solito rispondono entro 5 giorni
Tutte le issue di bellard/quickjs
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
-
bug severity: medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
AlessandroSangiuliano/Uros#1014 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
OpenXiangShan/NEMU#1314 ·
I maintainer di solito rispondono entro 1 giorno
-
`get_options()` repeats the first byte when hex-encoding octet stringsForse già presa @rue19 l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
OpenPrinting/cups#1830 ·
I maintainer di solito rispondono entro 1 giorno