php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68736 A long string in a special regex causes segmentation fault in PHP
Submitted: 2015-01-03 19:53 UTC Modified: 2015-01-04 13:56 UTC
From: kstirn at gmail dot com Assigned:
Status: Not a bug Package: *Regular Expressions
PHP Version: Irrelevant OS: Irrelevant
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: kstirn at gmail dot com
New email:
PHP Version: OS:

 

 [2015-01-03 19:53 UTC] kstirn at gmail dot com
Description:
------------
If a very long string with no spaces or newlines is passed to a special regex code, PHP crashes with a segmentation fault.

This regex code is for example used by phpBB.com to detect email addresses within text.

The exact same code works fine on shorter strings.

Test script:
---------------
Script that causes segmentation fault:
https://gist.github.com/kstirn/6ed881e8c090cc701d8a

Same code, but with a short string works fine:
https://gist.github.com/kstirn/e0564f92e39034cd0529


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-04 13:56 UTC] ab@php.net
-Status: Open +Status: Not a bug
 [2015-01-04 13:56 UTC] ab@php.net
Yes, excessive recursive matching can lead to the stack overflow in PCRE library, this is a known issue. Please note though, that a valid email address may be 256 chars only IIRC, that is probably the obvious way to fix this.

Thanks.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Dec 06 12:03:37 2021 UTC