Bug #71001 [NEW]: Regex with long input string causes SIGSEGV

From: Date: Mon, 30 Nov 2015 15:50:33 +0000
Subject: Bug #71001 [NEW]: Regex with long input string causes SIGSEGV
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-197522@lists.php.net to get a copy of this message
From: norman at cure53 dot de Operating system: Centos 6 PHP version: 5.6.16 Package: PCRE related Bug Type: Bug Bug description:Regex with long input string causes SIGSEGV Description: ------------ The following regex combined with an overly long string causes a sigsegv in PHP 5.3.20 - 5.6.16. No special modules or php.ini directives have been used. Test script: --------------- <?php // 5.3.20 - 5.6.16 $regex = "/^([a-z0-9]([a-z0-9-]*[a-z0-9])?\.)*[a-z]([a-z0-9-]*[a-z0-9])?\.?$/i"; $count = 10000; $string = str_repeat("a.",$count)."x.com"; if (preg_match($regex, $string)) { print "not vulnerable"; } ?> Expected result: ---------------- The script should print "not vulnerable" or exit normally. Actual result: -------------- The PHP process terminates with a sigsegv: php-fpm[31329]: [WARNING] [pool www] child 25489 exited on signal 11 (SIGSEGV) -- Edit bug report at https://bugs.php.net/bug.php?id=71001&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71001&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71001&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71001&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=71001&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=71001&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=71001&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=71001&r=needscript Try newer version: https://bugs.php.net/fix.php?id=71001&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=71001&r=support Expected behavior: https://bugs.php.net/fix.php?id=71001&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=71001&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=71001&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=71001&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71001&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=71001&r=dst IIS Stability: https://bugs.php.net/fix.php?id=71001&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=71001&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=71001&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=71001&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=71001&r=mysqlcfg

« previous php.bugs (#197522) next »