php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63923 filter_var( $mail, FILTER_VALIDATE_EMAIL) crash Apache if $mail longer than 155
Submitted: 2013-01-06 20:09 UTC Modified: 2013-01-07 20:18 UTC
From: remi at minimal-beton dot com Assigned:
Status: Not a bug Package: Reproducible crash
PHP Version: 5.3.20 OS: Windows 7
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: remi at minimal-beton dot com
New email:
PHP Version: OS:

 

 [2013-01-06 20:09 UTC] remi at minimal-beton dot com
Description:
------------
WHEN USING

filter_var( $mail, FILTER_VALIDATE_EMAIL) 

It EVERY TIME crashes Apache 

IF $mail is longer than 155 characters

-----------------------------------------
[Mon Dec 10 14:08:34 2012] [notice] Parent: Received shutdown signal -- Shutting 
down the server.
[Mon Dec 10 14:08:34 2012] [notice] Child 4212: Exit event signaled. Child 
process is ending.
[Mon Dec 10 14:08:35 2012] [notice] Child 4212: Released the start mutex
[Mon Dec 10 14:08:36 2012] [notice] Child 4212: All worker threads have exited.
[Mon Dec 10 14:08:36 2012] [notice] Child 4212: Child process is exiting
[Mon Dec 10 14:08:36 2012] [notice] Parent: Child process exited successfully.
[Mon Dec 10 14:08:36 2012] [notice] Apache/2.2.22 (Win64) PHP/5.3.13 configured 
-- resuming normal operations
[Mon Dec 10 14:08:36 2012] [notice] Server built: May 13 2012 19:41:17
[Mon Dec 10 14:08:36 2012] [notice] Parent: Created child process 2096
[Mon Dec 10 14:08:36 2012] [notice] Child 2096: Child process is running
[Mon Dec 10 14:08:36 2012] [notice] Child 2096: Acquired the start mutex.
[Mon Dec 10 14:08:36 2012] [notice] Child 2096: Starting 64 worker threads.
[Mon Dec 10 14:08:36 2012] [notice] Child 2096: Starting thread to listen on 
port 80.
[Mon Dec 10 14:08:36 2012] [notice] Child 2096: Starting thread to listen on 
port 80.



Test script:
---------------
filter_var(	"maiuuuuooumaidtotypo3mailtotypo3iiiiimailtotypo3mailtotypo3mailtotypo3mailtosssssmailtotypo3ppppppppppmailtotypo3mailtopdsdmarcheddefensedbrandolin@iiii.fr", FILTER_VALIDATE_EMAIL));



Expected result:
----------------
function must return FALSE or TRUE

Actual result:
--------------
It EVERY TIME crashes Apache 


-----------------------------------------
[Mon Dec 10 14:08:34 2012] [notice] Parent: Received shutdown signal -- Shutting 
down the server.
[Mon Dec 10 14:08:34 2012] [notice] Child 4212: Exit event signaled. Child 
process is ending.
[Mon Dec 10 14:08:35 2012] [notice] Child 4212: Released the start mutex
[Mon Dec 10 14:08:36 2012] [notice] Child 4212: All worker threads have exited.
[Mon Dec 10 14:08:36 2012] [notice] Child 4212: Child process is exiting
[Mon Dec 10 14:08:36 2012] [notice] Parent: Child process exited successfully.
[Mon Dec 10 14:08:36 2012] [notice] Apache/2.2.22 (Win64) PHP/5.3.13 configured 
-- resuming normal operations
[Mon Dec 10 14:08:36 2012] [notice] Server built: May 13 2012 19:41:17
[Mon Dec 10 14:08:36 2012] [notice] Parent: Created child process 2096
[Mon Dec 10 14:08:36 2012] [notice] Child 2096: Child process is running
[Mon Dec 10 14:08:36 2012] [notice] Child 2096: Acquired the start mutex.
[Mon Dec 10 14:08:36 2012] [notice] Child 2096: Starting 64 worker threads.
[Mon Dec 10 14:08:36 2012] [notice] Child 2096: Starting thread to listen on 
port 80.
[Mon Dec 10 14:08:36 2012] [notice] Child 2096: Starting thread to listen on 
port 80.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-01-07 18:38 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2013-01-07 18:38 UTC] pajoye@php.net
Can you try in CLI please? While you did not provide a backtrace, I am pretty sure 
it is related to PCRE stack limit issue.
 [2013-01-07 19:17 UTC] ab@php.net
After

editbin /stack:16777216 httpd.exe

I get bool(false) while running under apache. Previously crash with the default value. Seems like it can be solved with just increasing the stack size
 [2013-01-07 20:08 UTC] remi at minimal-beton dot com
16 Mo to manage a 160 length string...

I'm not enough good to understand :(
 [2013-01-07 20:08 UTC] remi at minimal-beton dot com
-Status: Feedback +Status: Open
 [2013-01-07 20:11 UTC] pajoye@php.net
it is the PCRE regex to parse the email, it needs recursion. It may not use the 
16MB but most of apache builds out there use a way too small stack size on 
windows. Much smaller than on Linux.
 [2013-01-07 20:14 UTC] remi at minimal-beton dot com
Haaaaaaaaaaaaaaaaaaaaaaaaaaaa :)

I'm starting to understand :)

Thanks.
 [2013-01-07 20:18 UTC] pajoye@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Issue with pcre and stack size.
 [2013-01-07 20:18 UTC] pajoye@php.net
-Status: Open +Status: Not a bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 07 21:01:30 2024 UTC