Bug #79241 [NEW]: Segmentation fault on preg_match()

From: Date: Fri, 07 Feb 2020 15:10:41 +0000
Subject: Bug #79241 [NEW]: Segmentation fault on preg_match()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225428@lists.php.net to get a copy of this message
From: ivan dot voskoboinyk at gmail dot com Operating system: Ubuntu 19.04 PHP version: 7.4.2 Package: PCRE related Bug Type: Bug Bug description:Segmentation fault on preg_match() Description: ------------ We had this bug on our production server happening on matching Regex on a unicode string decoded from JSON. I've taken the exact production code and removed everything that is not necessary for demonstrating the problem. Removing any other part from the snippet bellow fixes the crash. It seems the issue only appeared in PHP 7.4: https://3v4l.org/DqL76 Test script: --------------- // if "’" string is used directly without json_decode, // the issue does not reproduce $text = json_decode('"’"'); $pattern = '/\b/u'; // it has to be exact two calls to preg_match(), // with the second call offsetting after the tick symbol preg_match($pattern, $text, $matches, 0, 0); preg_match($pattern, $text, $matches, 0, 1); echo 'OK'; Expected result: ---------------- "OK" is output Actual result: -------------- Segmentation fault (core dumped) -- Edit bug report at https://bugs.php.net/bug.php?id=79241&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79241&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79241&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79241&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79241&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79241&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79241&r=support Expected behavior: https://bugs.php.net/fix.php?id=79241&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79241&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79241&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79241&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79241&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79241&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79241&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79241&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79241&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79241&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79241&r=mysqlcfg

« previous php.bugs (#225428) next »