from Hacker News

JavaScript timers can be bypassed with “Infinity”

by CryoLogic on 7/28/21, 6:09 PM with 11 comments

  • by dragonwriter on 7/28/21, 7:11 PM

    Its not “bypassing” if you have to write the code used to setup the timer to do it.

    I suppose it implies the existence of a class of potential problems if an application (1) accepts user input for timer delays, (2) requires a certain minimum delay, (3) only checks that the entered amount is >= the minimum without considering overflow behavior. But, since this behavior is well-documented (the MDN page on setTimeout covers it), it doesn't seem like any kind of notable discovery.

  • by himinlomax on 7/28/21, 8:38 PM

    Am I missing something or is this as dumb as it looks? How's that different from using 0?
  • by whoomp12342 on 7/28/21, 7:50 PM

    this is no different than passing 0 right? I fail to see the significance, other than the fact that infinity doesn't work the way you think it would.
  • by zodiakzz on 7/28/21, 7:00 PM

    "Hack"? Cute. Is this guy's first day at programming?