com php-src: fix negative zend_long to size_t cast: ext/standard/string.c
| From: | Anatol Belski | Date: | Mon, 29 Jun 2015 08:27:42 +0000 |
| Subject: | com php-src: fix negative zend_long to size_t cast: ext/standard/string.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-87607@lists.php.net to get a copy of this message | ||
Commit: 5060060317b0fd8c8d806c81e673b37ffb830159
Author: Anatol Belski <ab@php.net> Mon, 29 Jun 2015 10:27:13 +0200
Parents: 8271890d8dd600a8b91fe41b2996ffdd878e2f6e
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5060060317b0fd8c8d806c81e673b37ffb830159
Log:
fix negative zend_long to size_t cast
Changed paths:
M ext/standard/string.c
Diff:
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 6c5e58e..101e88b 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -2484,9 +2484,10 @@ PHP_FUNCTION(substr_replace)
* of the string
*/
if (f < 0) {
- f = Z_STRLEN_P(str) + f;
- if (f < 0) {
+ if (f < 0 && -f > Z_STRLEN_P(str)) {
f = 0;
+ } else {
+ f = Z_STRLEN_P(str) + f;
}
} else if (f > Z_STRLEN_P(str)) {
f = Z_STRLEN_P(str);