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 87fed88 commit 5259e5f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Float16Array.mjs
Expand Up @@ -1046,6 +1046,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 @@ -1083,7 +1088,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 5259e5f

Please sign in to comment.