Skip to content

Commit

Permalink
Avoid userland re-entrance after a read in Float16Array#spliced
Browse files Browse the repository at this point in the history
  • Loading branch information
petamoriken committed Jun 26, 2022
1 parent e458f3f commit edf3bc3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Float16Array.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,11 @@ export class Float16Array {
}

const insertCount = items.length;
const converedItems = [];
for (let i = 0; i < insertCount; ++i) {
converedItems[i] = ToNumber(items[i]);
}

let actualDeleteCount;
switch (arguments.length) {
case 0:
Expand Down Expand Up @@ -1081,7 +1086,7 @@ export class Float16Array {
}

for (let i = 0; i < insertCount; ++i) {
array[k] = roundToFloat16Bits(items[i]);
array[k] = roundToFloat16Bits(converedItems[i]);
++k;
}

Expand Down

0 comments on commit edf3bc3

Please sign in to comment.