Summary
Setting a regular array's length to an invalid value through an any-typed
binding segfaults (SIGSEGV, exit 139) instead of throwing RangeError.
Repro
const a = [1, 2, 3];
try { (a as any).length = -1; } catch (e: any) { console.log("threw", e.name); }
console.log("done");
- Node:
threw RangeError / done
- Perry: segfaults during the assignment (no output past the array literal)
The statically-typed form likely differs; the as any set routes through the
generic dynamic property-set path.
Crash detail
EXC_BAD_ACCESS (address=0x3ffffffffffffff8) — a raw f64 (2.0 =
0x4000000000000000) is treated as an object pointer and its GC header is read
at [ptr-8]. The faulting frame is a GC_TYPE_SET type check reached from the
array-length set path. So a numeric value is being threaded into a routine that
dereferences it as a heap object.
Scope / provenance
Summary
Setting a regular array's
lengthto an invalid value through anany-typedbinding segfaults (SIGSEGV, exit 139) instead of throwing
RangeError.Repro
threw RangeError/doneThe statically-typed form likely differs; the
as anyset routes through thegeneric dynamic property-set path.
Crash detail
EXC_BAD_ACCESS (address=0x3ffffffffffffff8)— a rawf64(2.0=0x4000000000000000) is treated as an object pointer and its GC header is readat
[ptr-8]. The faulting frame is aGC_TYPE_SETtype check reached from thearray-length set path. So a numeric value is being threaded into a routine that
dereferences it as a heap object.
Scope / provenance
mainbuild (isolated target, cold build) underboth
PERRY_NO_AUTO_OPTIMIZE=1and the default auto-optimize path —independent of any in-flight branch.
test-parity/node-suite/globals/array-length-invalid.tsandstructured-clone-transfer.tsfail (both exercise this set path).