Skip to content

Commit 09c5aa5

Browse files
authored
Merge pull request #213 from SgLy/fix-invalid-numeric-for
fix(core): ensure numeric for-value to be valid array length
2 parents f85b102 + 2a56b97 commit 09c5aa5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

glass-easel/src/tmpl/range_list_diff.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,11 @@ export class RangeListManager {
7171
this.ownerShadowRoot.getHostNode(),
7272
this.elem,
7373
)
74-
items = new Array<string>(dataList)
74+
const length =
75+
Number.isSafeInteger(dataList) && dataList >= 0 && dataList < 2 ** 32 ? dataList : 0
76+
items = new Array<string>(length)
7577
indexes = null
76-
for (let i = 0; i < dataList; i += 1) {
78+
for (let i = 0; i < length; i += 1) {
7779
items[i] = i
7880
}
7981
} else {

0 commit comments

Comments
 (0)