com php-src: moved the check to the right place and fixed wording: ext/pcre/php_pcre.c
| From: | Anatol Belski | Date: | Mon, 18 Nov 2013 16:28:48 +0000 |
| Subject: | com php-src: moved the check to the right place and fixed wording: ext/pcre/php_pcre.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-73978@lists.php.net to get a copy of this message | ||
Commit: 0cac40e87946b98c6a504d0237f3adb3d32daa4b
Author: Anatol Belski <ab@php.net> Mon, 18 Nov 2013 17:28:48 +0100
Parents: c398bdd4a34cc4b5cff38ae1a47d475581480045
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0cac40e87946b98c6a504d0237f3adb3d32daa4b
Log:
moved the check to the right place and fixed wording
Changed paths:
M ext/pcre/php_pcre.c
Diff:
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 46540d8..75454cf 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -1048,11 +1048,6 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject,
zend_st
return NULL;
}
- if (Z_STRSIZE_P(replace_val) > INT_MAX) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Subject is too long");
- return NULL;
- }
-
if (extra == NULL) {
extra_data.flags = PCRE_EXTRA_MATCH_LIMIT | PCRE_EXTRA_MATCH_LIMIT_RECURSION;
extra = &extra_data;
@@ -1069,6 +1064,10 @@ PHPAPI char *php_pcre_replace_impl(pcre_cache_entry *pce, char *subject,
zend_st
} else {
replace = Z_STRVAL_P(replace_val);
replace_len = Z_STRSIZE_P(replace_val);
+ if (replace_len > INT_MAX) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Replacement is too long");
+ return NULL;
+ }
replace_end = replace + replace_len;
}