You can't prevent infinite loops unless you've solved the halting problem right?
They could of course just limit the run time if they really wanted to make sure scripts don't run indefinitely.
They could of course just limit the run time if they really wanted to make sure scripts don't run indefinitely.
Only in general arbitrary turing complete runtimes. For restricted subsets of instructions and specific implementations of runtimes you can. E.g. one could trivially disallow "jump" control flow, and limit loops to N iterations.
It seems as though this would be more robust than limiting the number of bytecode instructions. I wonder if that’s true and if so, why it’s not more commonly recommended.