Re: Recovering from a hung regex
| From: | Christoph M. Becker | Date: | Mon, 25 May 2020 14:15:23 +0000 |
| Subject: | Re: Recovering from a hung regex | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-327161@lists.php.net to get a copy of this message | ||
On 24.05.2020 at 17:23, Shivanand Sharma wrote:
> We have a file scanner where data / files is user-supplied and the regexes
> are OSINT supplied. The script has no control over either and just needs to
> do its job successfully.
>
> However the script hangs with pcre version 10.34 2019-11-21. This seems
> like a bug in pcre itself.
>
> Demo: https://github.com/sharmashivanand/php-hang-demo
>
> That said, however what is the right way to recover from such a hang and
> continue execution when such external libraries fail? We are the developers
> but the script has a user-base and needs to run in varied environments.
This looks like a bug in the PCRE JIT implementation. Running with -d
pcre.jit=0 does not hang (script finishes instantly).
--
Christoph M. Becker