Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87291 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24159 invoked from network); 25 Jul 2015 16:01:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jul 2015 16:01:40 -0000 Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.15.18 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.15.18 mout.gmx.net Received: from [212.227.15.18] ([212.227.15.18:58981] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 15/41-12869-2E2B3B55 for ; Sat, 25 Jul 2015 12:01:39 -0400 Received: from [192.168.0.100] ([95.89.139.132]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0Lu7a2-1Yt4zT2mXu-011Q0E; Sat, 25 Jul 2015 18:01:33 +0200 Message-ID: <55B3B2E6.7080905@gmx.de> Date: Sat, 25 Jul 2015 18:01:42 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Anatol Belski , 'Pierre Joye' CC: 'PHP internals' References: <55B0CADD.8000807@gmx.de> <55B136BE.8010006@gmx.de> <046401d0c644$9cf76880$d6e63980$@belski.net> <55B2B78A.4080202@gmx.de> <048001d0c665$ed19ec40$c74dc4c0$@belski.net> <55B2D779.9090409@gmx.de> <04d301d0c6e5$6b28f0c0$417ad240$@belski.net> In-Reply-To: <04d301d0c6e5$6b28f0c0$417ad240$@belski.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:Gi4TTIzXKsFlBMTqAR7kOD+y/VOkcsHucecjSYgmwSb6h+6+2tc cbHoGo/5nRxdD+jgwDa5RA4/JqLEFXGdAM8n6UpR+DcXbPYlZQDwmjNx0FSmHo9oaeBy0/l +b1x/AyAw6Bsmm7WWGxUsb+2YmUqQEWzjFfEqwWp+/luR+A1WBGD2zc7koZQAaL/2jt7glW tIqwcN1akvxS5LYQN2YQg== X-UI-Out-Filterresults: notjunk:1;V01:K0:FzBYlk1snl0=:R26HJrbUiFsQdAq3fkMPas OhBlj4YO6/xu1OexpEYnLLs6P/n2VQC4dSvNUWpxH/1TrTuTU5Aw5t6ZFSkWlrl8ufl5V1jUI LSewjX540+W9aR1BKNrDZ79qK+5jDILGhHt4xCI1gQmqSbxpmB0ky1tMGDFW8vxidTigED/oy 9k+s86s7CyHrE0vOIGEQessK4sZqamypXN09FbfH7j6gsXvxEg7giFUHHbrnwLKD7wL/eWPXd kaJs4SLl3WZnz6RfthFBRLeSH0dCs4DSkvbhAix9AW0gerp3UxkifNujTZx8AiBAtIKLjlOTd pMQB+ZD+9mXLUCwTs0AMPfnDUbzv9ic+stw6iZzCCnht7IyYlybUCG1Oaygvn+wychH7B5AT+ T5xDRPfCz5RU+ay5lT98EqueZAwPTWVawCGfZN1JtWj6C1Dsta+uzTvZp8AMQPGj2XBZXHOi4 2UaXeRLQEmD3rtsT8QwzJRPaLOQhkKAHIvw6l9604rWw3MZk2Or8CqU/4WYTigZCKLX15Ceoh aaSh0moEph4G+urefrPt82lTGkUN1m7TyKAco9muSEc+ErU1/GRb9/AbQLwduySgxOWMa9dmL YwGq5XIB6et5U21USOPYGL7diehzRr9Dv8ua/EN1GS5OTYpaM4pXRJaN+/QZAYY2lA1sMfRJB qtiZFgaDk7dT6AA8mu6SiLCPv9wk7Ei+YqJCwoObEf1367qAwSbLQ8dumrjk/dgulXzY= Subject: Re: [PHP-DEV] PCRE JIT stack size limit From: cmbecker69@gmx.de (Christoph Becker) Hi Anatol, Anatol Belski wrote: >> -----Original Message----- >> From: Christoph Becker [mailto:cmbecker69@gmx.de] >> Sent: Saturday, July 25, 2015 2:25 AM >> To: Anatol Belski ; 'Pierre Joye' >> >> Cc: 'PHP internals' >> Subject: Re: [PHP-DEV] PCRE JIT stack size limit >> >> I would not suggest to change the return value of preg_match() and friends. >> FALSE seems to be appropriate here. Instead I suggest to add a new error >> constant which would be returned from preg_last_error(). >> > Yep, sounds feasible. At least users can be informed about this kind of error, seems a constant is feasible for 7.0. That would be nice. I'll make a respective PR. > Btw I've just noticed that the snippet I've posted earlier won't currently work. > > If (false === preg_match(",evil pattern,", ...)) { > If (OUT_OF_JIT_STACK == pcre_last_error()) { > ini_set("pcre.jit", 0); > // retry > } > } > > The retry would fail even when JIT is disabled on demand. This is actually rather unexpected, maybe something in PCRE JIT state cannot be recovered once JIT compilation has failed. But actually, even without running into debugging, it is also a bad sign telling that the behavior can get complicated ( Indeed! That's caused by our PCRE cache. The cached regex is alread studied with JIT info, as all that happens in pcre_get_compiled-regex_cache[1]. So switching pcre.jit at runtime may not have the desired effect. I'm not sure if that has to be regarded as bug, and whether we should do something about it. One solution might be to clear the regex cache whenever the ini setting changes. I'll have a closer look. > Running for the INI option and some custom JIT stack functionality needs more brainstorming and test. Please ping when you have an initial implementation, I'd be glad to help testing, etc. anyway. All in all it seems that we probably should have an RFC for that. I'll consider to write one, but there's no need to hurry – too late for 7.0 anyway. :) [1] -- Christoph M. Becker