Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87267 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80453 invoked from network); 24 Jul 2015 11:28:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Jul 2015 11:28:49 -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:58402] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D3/33-57278-07122B55 for ; Fri, 24 Jul 2015 07:28:49 -0400 Received: from [192.168.0.100] ([95.89.139.132]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0MLOMM-1ZI3Bv2rDO-000ZOe; Fri, 24 Jul 2015 13:28:45 +0200 Message-ID: <55B22174.1020704@gmx.de> Date: Fri, 24 Jul 2015 13:28:52 +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: Adam Harvey CC: PHP internals References: <55B0CADD.8000807@gmx.de> <55B136BE.8010006@gmx.de> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:0g7TpHt7VtvlF8jWx89AGDrOBH+sfRtNSXwl4CEgKe59sjlkoGa a/DEmONqzRKdBKPrSK71QanRc8mG/O9WPvR09t8So8ykHHjFg71UrLc3s8ydHUgBFrnCyMT AixfVWiMpUQzswxTe8Xlthejv14+q+HSLFZkFXfeO9Rgkw8/dHK9oBdbFZfdrxKWpatkyJT 4vsfA8uLUfaitQR16IiVQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:kpsrZYVacOI=:XvnMmhg3ZNHf/tACy0hv34 KrKcahnZciwQ4tsDV+R07TZRcGZ/svrqI5xSmMmR+4O2UBmyv6zhFS+CXr9zzOCp+U2raJVnO F3T/oIgVU3+bm96hX/zsvOoWlKEVwuip7VWHuHlxo92WP4biQGbBPaI2eQ2dKzt7OnEWPbYsl 5BAmK/wITOQC+NRm4r/5w0kMZ/OVaX6N84lLlUeNHTKraH2EHvFR/p2QuB/k3D+uyLm7fZZu9 8XGht1oXHdZPmZCHYj/cH7VIztsbqYPN6HK7RYaFi4qCPlfubAY95dIPnvxIJmN73TSSs7FiA SkF/F4BcoW0cVKnsQt/li6UfgXKv/hvJxL2NgBucgTM+arr+hoJ+Sqkgb0mjkZisNd6r2QeAs fM+L0b3pfVRYq5nNoNLcMVpbyDCmdq+Q6+aeEuXRHaGWDjeWovY+mpvrsIlrSU3MM29lH4vyM RAUv4iVtxobM2riWYRytUkXh2zr825qV6GN/YJRSMJh19KWx8s9zvlWWiIdP6TAoP8QLNwt0H BnJ89l8E2mbRED7VfKf7Jm+TSzpY27um66Le9xBLRkblczhkkuVHKjrp7AQ5KD7A3aTJtaW2i lCE/RgF3w6BkBACWHO5b+s0ail25ucivpjrVN/ieuPYb3yKuZyo7FnI3ZIDKpQwGnuVc69Eut e6FVh8TPDsT4DvFm79fsqBOLIilMrlXa62uT0Ta6t9RnxASkIOZKHRytrTtRa1yFF9rY= Subject: Re: [PHP-DEV] PCRE JIT stack size limit From: cmbecker69@gmx.de (Christoph Becker) Adam Harvey wrote: > On 23 July 2015 at 11:47, Christoph Becker wrote: > >> Therefore I tend to prefer a new ini setting (say, pcre.jitstack_limit). >> That would mean, however, to add yet another ini setting, of which >> there are already so many. > > I'm not a big fan of that, although it's at least in the spirit of > what configuration settings are meant to be used for. > > What if we added the PCRE_ERROR_JIT_STACKLIMIT error constant to those > exposed to userland so that it's more easily noticed via > preg_last_error(), and adding a modifier that can be used to disable > the JIT on a per-pattern basis (by setting PCRE_NO_START_OPTIMIZE, > which admittedly disables other stuff too, but at least the regex will > run)? At least then users could check the error when the regex fails > and re-run the regex without the JIT if they chose to. Yes, that would be an option. I'm not sure if we need to touch PCRE_NO_START_OPTIMIZE (or if it would even help); simply not calling pcre_study() respectively not passing the studied extra data (second argument) to pcre_exec() should be sufficient. > How likely is the average user to hit this, do you think? I don't know. The libpcre man pages say: | JIT uses far less memory for recursion than the interpretive code, | and a maximum stack size of 512K to 1M should be more than enough for | any pattern. Of course, a hard-coded 512K or even more would be rather much. The default stack size (32K) for the regex in the test script of #70110 would be sufficient, if the subject is repeated only about 2000 times, but that doesn't say much (the preg_match() is rather contrived). Anyway, that shows that it's not only the pattern that's relevant for the needed JIT stack space, but also the subject string. -- Christoph M. Becker