com php-src: final fix for hebrev(): ext/standard/string.c
| From: | Anatol Belski | Date: | Wed, 16 Oct 2013 10:09:50 +0000 |
| Subject: | com php-src: final fix for hebrev(): ext/standard/string.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-73477@lists.php.net to get a copy of this message | ||
Commit: 4be4279c83650f378d44d9f9855ef1f266e436cd
Author: Anatol Belski <ab@php.net> Thu, 22 Aug 2013 06:06:24 -0700
Parents: 832e9653d1a779766a40273385ee638e8f23e3c2
Branches: str_size_and_int64
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4be4279c83650f378d44d9f9855ef1f266e436cd
Log:
final fix for hebrev()
Changed paths:
M ext/standard/string.c
Diff:
diff --git a/ext/standard/string.c b/ext/standard/string.c
index fb139c9..9845645 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -4129,7 +4129,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines)
while (1) {
char_count=0;
- while ((!max_chars || char_count < max_chars) && begin > 0) {
+ while ((!max_chars || max_chars > 0 && char_count < max_chars) && begin
> 0) {
char_count++;
begin--;
if (begin <= 0 || _isnewline(heb_str[begin])) {
@@ -4140,7 +4140,7 @@ static void php_hebrev(INTERNAL_FUNCTION_PARAMETERS, int convert_newlines)
break;
}
}
- if (char_count == max_chars) { /* try to avoid breaking words */
+ if (max_chars >= 0 && char_count == max_chars) { /* try to avoid breaking words */
zend_str_size_int new_char_count=char_count, new_begin=begin;
while (new_char_count > 0) {