Hacker News new | ask | show | jobs
by exDM69 482 days ago
Yes, this is a good idea. I've done this before with binary search and tree structures. I avoid unbounded loops wherever possible and the unavoidable cases are rather rare.

It's not a fix but it is a good mitigation strategy.

Infinite loops are one of the nastiest kind of bugs. Although they are easy to spot in a debugger they can have really unfriendly consequences like OP's "can barely ssh in" situation.

Infinite loops in library code are particularly unpleasant.