com php-src: Fixed bug #74873 (Minor BC break: PCRE_JIT cha nges output of preg_match()).: NEWS ext/p cre/php_pcre.c ext/pcre/tests/bug74873.phpt
| From: | Dmitry Stogov | Date: | Fri, 07 Jul 2017 06:54:21 +0000 |
| Subject: | com php-src: Fixed bug #74873 (Minor BC break: PCRE_JIT cha nges output of preg_match()).: NEWS ext/p cre/php_pcre.c ext/pcre/tests/bug74873.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-98444@lists.php.net to get a copy of this message | ||
Commit: 29653da385f89dcf00ebbb6823a395e1484d4dc3
Author: Dmitry Stogov <dmitry@zend.com> Fri, 7 Jul 2017 09:54:21 +0300
Parents: 5a991ea49b1accf766e0044e10a3712fe0399a27
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=29653da385f89dcf00ebbb6823a395e1484d4dc3
Log:
Fixed bug #74873 (Minor BC break: PCRE_JIT changes output of preg_match()).
Bugs:
https://bugs.php.net/74873
Changed paths:
M NEWS
M ext/pcre/php_pcre.c
A ext/pcre/tests/bug74873.phpt
Diff:
diff --git a/NEWS b/NEWS
index 96726fe..8a05976 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,10 @@ PHP NEWS
. Fixed bug #74651 (negative-size-param (-1) in memcpy in zif_openssl_seal()).
(Stas)
+- PCRE:
+ . Fixed bug #74873 (Minor BC break: PCRE_JIT changes output of preg_match()).
+ (Dmitry)
+
06 Jul 2017, PHP 7.2.0alpha3
- Core:
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 5b07951..9779afa 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -826,6 +826,10 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int
subjec
#ifdef HAVE_PCRE_JIT_SUPPORT
if ((extra->flags & PCRE_EXTRA_EXECUTABLE_JIT)
&& no_utf_check && !g_notempty) {
+ if (start_offset < 0 || start_offset > subject_len) {
+ pcre_handle_exec_error(PCRE_ERROR_BADOFFSET);
+ break;
+ }
count = pcre_jit_exec(pce->re, extra, subject, (int)subject_len, (int)start_offset,
no_utf_check|g_notempty, offsets, size_offsets, jit_stack);
} else
diff --git a/ext/pcre/tests/bug74873.phpt b/ext/pcre/tests/bug74873.phpt
new file mode 100644
index 0000000..9b64dae
--- /dev/null
+++ b/ext/pcre/tests/bug74873.phpt
@@ -0,0 +1,8 @@
+--TEST--
+Bug #74873 (Minor BC break: PCRE_JIT changes output of preg_match())
+--FILE--
+<?php
+var_dump(preg_match('/\S+/', 'foo bar', $matches, 0, 99999));
+?>
+--EXPECT--
+bool(false)
\ No newline at end of file