Bug #68736 [Opn->Nab]: A long string in a special regex causes segmentation fault in PHP

From: Date: Sun, 04 Jan 2015 13:56:45 +0000
Subject: Bug #68736 [Opn->Nab]: A long string in a special regex causes segmentation fault in PHP
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189642@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68736&edit=1 ID: 68736 Updated by: ab@php.net Reported by: kstirn at gmail dot com Summary: A long string in a special regex causes segmentation fault in PHP -Status: Open +Status: Not a bug Type: Bug Package: *Regular Expressions Operating System: Irrelevant PHP Version: Irrelevant Block user comment: N Private report: N New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [2015-01-03 19:53:14] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68736&edit=1

« previous php.bugs (#189642) next »