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 Dec 6, 2022
1 parent e4d8b75 commit a15142b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Float16Array.mjs
Expand Up @@ -1044,6 +1044,11 @@ export class Float16Array {
}

const insertCount = items.length;
const converedItems = [];
for (let i = 0; i < insertCount; ++i) {
converedItems[i] = +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 a15142b

Please sign in to comment.