com php-src: Fixed bug #70868 (PCRE JIT and pattern reuse segfault): NEWS Zend/tests/bug70868.phpt ext/spl/spl_iterators.c ext/spl/
tests/bug70868.phpt

From: Date: Fri, 06 Nov 2015 03:37:17 +0000
Subject: com php-src: Fixed bug #70868 (PCRE JIT and pattern reuse segfault): NEWS Zend/tests/bug70868.phpt ext/spl/spl_iterators.c ext/spl/
tests/bug70868.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-89610@lists.php.net to get a copy of this message
Commit: 27aef97f658dd956db0cf4145963d9d57d31dacc Author: Xinchen Hui <laruence@gmail.com> Fri, 6 Nov 2015 11:37:17 +0800 Parents: 283b6275df22a2e94a723a135291014b17317630 Branches: PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=27aef97f658dd956db0cf4145963d9d57d31dacc Log: Fixed bug #70868 (PCRE JIT and pattern reuse segfault) Bugs: https://bugs.php.net/70868 Changed paths: M NEWS D Zend/tests/bug70868.phpt M ext/spl/spl_iterators.c A ext/spl/tests/bug70868.phpt Diff: diff --git a/NEWS b/NEWS index b191232..0985ae6 100644 --- a/NEWS +++ b/NEWS @@ -19,6 +19,7 @@ PHP NEWS test suite). (Anatol) - SPL: + . Fixed bug #70868 (PCRE JIT and pattern reuse segfault). (Laruence) . Fixed bug #70853 (SplFixedArray throws exception when using ref variable as index). (Laruence) diff --git a/Zend/tests/bug70868.phpt b/Zend/tests/bug70868.phpt deleted file mode 100644 index d3dd763..0000000 --- a/Zend/tests/bug70868.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -Bug #70868, with PCRE JIT ---INI-- -pcre.jit=1 ---SKIPIF-- -<?php if (!extension_loaded("pcre")) die("skip"); ?> ---FILE-- -<?php - -namespace X; - -$iterator = - new \RegexIterator( - new \ArrayIterator(['A.phpt', 'B.phpt', 'C.phpt']), - '/\.phpt$/' - ) -; - -foreach ($iterator as $foo) { - var_dump($foo); - preg_replace('/\.phpt$/', '', ''); -} - -echo "Done", PHP_EOL; - -?> ---EXPECTF-- - -string(6) "A.phpt" -string(6) "B.phpt" -string(6) "C.phpt" -Done diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index cd0c624..b29fc52 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -2059,6 +2059,11 @@ SPL_METHOD(RegexIterator, accept) { case REGIT_MODE_MAX: /* won't happen but makes compiler happy */ case REGIT_MODE_MATCH: +#ifdef PCRE_EXTRA_MARK + if (intern->u.regex.pce->extra) { + intern->u.regex.pce->extra->flags &= ~PCRE_EXTRA_MARK; + } +#endif count = pcre_exec(intern->u.regex.pce->re, intern->u.regex..pce->extra, ZSTR_VAL(subject), ZSTR_LEN(subject), 0, 0, NULL, 0); RETVAL_BOOL(count >= 0); break; diff --git a/ext/spl/tests/bug70868.phpt b/ext/spl/tests/bug70868.phpt new file mode 100644 index 0000000..d3dd763 --- /dev/null +++ b/ext/spl/tests/bug70868.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #70868, with PCRE JIT +--INI-- +pcre.jit=1 +--SKIPIF-- +<?php if (!extension_loaded("pcre")) die("skip"); ?> +--FILE-- +<?php + +namespace X; + +$iterator = + new \RegexIterator( + new \ArrayIterator(['A.phpt', 'B.phpt', 'C..phpt']), + '/\.phpt$/' + ) +; + +foreach ($iterator as $foo) { + var_dump($foo); + preg_replace('/\.phpt$/', '', ''); +} + +echo "Done", PHP_EOL; + +?> +--EXPECTF-- + +string(6) "A.phpt" +string(6) "B.phpt" +string(6) "C.phpt" +Done

« previous php.cvs (#89610) next »