jashkenas/underscore

Bug with _.range() with a bad start point

yagudaev opened this issue · 2 comments

If you call _.range() or _.range("", 2000) or _.range(null, null) or _.range(null, 2000), underscore will return an very long array (almost infinite, but probably just reaches the limit of array size in javascript or on the machine) as such ["", "1", "11", "111", "1111", "1111", "11111"...].

This looks like a classic case of both concatenation of a string instead of addition ('' + 1) and an infinite loop.

btw, you might want to check out #634

Yep -- that's why you need to call range with numbers. We don't want to make this "work".