react-range icon indicating copy to clipboard operation
react-range copied to clipboard

Infinity loop with `step` equals zero

Open Deliaz opened this issue 5 years ago • 1 comments

There is a case that leads to the infinity loop and page freezing: passing step: 0. The this.numOfMarks becomes Infinity and the loop on line 61 will go forever.

https://github.com/tajo/react-range/blob/d7980b31e7eca8e184a212437a5f4d935dabd278/src/Range.tsx#L54-L63

What do you think about resetting step to the default value 1 in case of passed zero?

Deliaz avatar Oct 15 '20 14:10 Deliaz

It's probably better to just throw an error so it's obvious for the developer.

tajo avatar Oct 15 '20 17:10 tajo