From b3591d28dff59efb9c6465f14b8ed1d082a54262 Mon Sep 17 00:00:00 2001 From: u9g Date: Sun, 20 Feb 2022 15:25:35 -0500 Subject: [PATCH] Spreadsheet: Prevent infinite loop in Range ctor --- Base/res/js/Spreadsheet/runtime.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Base/res/js/Spreadsheet/runtime.js b/Base/res/js/Spreadsheet/runtime.js index ac0218db0d42d5..758ea24fd40b19 100644 --- a/Base/res/js/Spreadsheet/runtime.js +++ b/Base/res/js/Spreadsheet/runtime.js @@ -162,6 +162,9 @@ class Ranges { class Range { constructor(startingColumnName, endingColumnName, startingRow, endingRow, columnStep, rowStep) { + // using == to account for '0' since js will parse `+'0'` to 0 + if (columnStep == 0 || rowStep == 0) + throw new Error("rowStep or columnStep is 0, this will cause an infinite loop"); this.startingColumnName = startingColumnName; this.endingColumnName = endingColumnName; this.startingRow = startingRow;