Symptom
Reading a typed array out of bounds returns 0 instead of undefined:
const t = new Uint8Array([5, 6, 7]);
console.log(t[9]); // node: undefined perry: 0
const a: any = t;
console.log(a[9]); // node: undefined perry: 0
Reproduces for both a statically-typed Uint8Array receiver and an any-typed
one (so it is not generator/CPS-specific). In-bounds reads are correct
(t[0] === 5).
Notes
Spec: an integer-indexed exotic object returns undefined for a
CanonicalNumericIndexString that is out of [0, length). The dynamic path
(js_dyn_index_get → js_typed_array_index_get_dynamic) and the inline
fast/slow typed-array get appear to fall through to a 0 default on OOB rather
than undefined.
Found tangentially while fixing #6067 (generator local string OOB index);
independent of that (string-only) fix. Low urgency — filing for tracking.
Symptom
Reading a typed array out of bounds returns
0instead ofundefined:Reproduces for both a statically-typed
Uint8Arrayreceiver and anany-typedone (so it is not generator/CPS-specific). In-bounds reads are correct
(
t[0] === 5).Notes
Spec: an integer-indexed exotic object returns
undefinedfor aCanonicalNumericIndexString that is out of
[0, length). The dynamic path(
js_dyn_index_get→js_typed_array_index_get_dynamic) and the inlinefast/slow typed-array get appear to fall through to a
0default on OOB ratherthan
undefined.Found tangentially while fixing #6067 (generator local string OOB index);
independent of that (string-only) fix. Low urgency — filing for tracking.