[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft-devel] endless loops in bytecode
From: |
Alexei Podtelezhnikov |
Subject: |
Re: [ft-devel] endless loops in bytecode |
Date: |
Mon, 12 Sep 2016 10:09:55 -0400 |
On Sat, Sep 10, 2016 at 1:38 PM, Werner LEMBERG <address@hidden> wrote:
> do you have any ideas how to discover endless loops in bytecode that
> don't change the nesting level?
>
> My only idea up to date is to count JMPR, JROT, and JROF separately,
> using a threshold of, say, 10000.
It turns out this is a famous CS topic:
https://en.wikipedia.org/wiki/Halting_problem
So your idea of counting jumps is cheap and reasonable. I would run a
total jump count of any kind though and stop after 1000 jumps of any
kind. Enough is enough.The bytecode length is limited to 65536 (no?).
In the worst case scenario, 1000 jumps will produce 65 million
instructions. Perhaps, the total jump count should be even smaller,
like 100.