in reply to Re: catching infinite loops
in thread catching infinite loops

replace $x with $y, both of which are externally input to script from config file. When you have tested it works, infinite loop can't happen. But, if an external developer decides to add their own config file, if they make a typo, the replace loop could go on forever.

eg, ee -> e is OK, but would need to be looped until it fails. eeeee -> eee -> ee -> e -> done.

But, say they entered these the other way round by mistake. eee -> eeeeee -> eeeeeeeeeeee ....

Not the exact case, but that should give you an idea...

cLive ;-)

Replies are listed 'Best First'.
Re (tilly) 3: catching infinite loops
by tilly (Archbishop) on Apr 21, 2001 at 08:12 UTC
    In that case a time-based catch is going to be rather inadequate. A fast memory leak doesn't take long to hurt.

    Instead I would suggest either setting a maximum number of iterations, or looking into what your OS supplies in the way of things like ulimit...