Re: Re: cvs: php4(PHP_4_3) /ext/standard array.c
| From: | Moriyoshi Koizumi | Date: | Thu, 26 Dec 2002 15:08:34 +0000 |
| Subject: | Re: Re: cvs: php4(PHP_4_3) /ext/standard array.c | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-92832@lists.php.net to get a copy of this message | ||
Andrei Zmievski wrote:
Was this fix entirely necessary? It didn't seems like a showstopper bug. First, I apologize I didn't ask you for permission before committing my patch.Actually it might not be a showstopper, but I believe this should be fixed before the release, because it's a bug that causes segfault in usual usage. Moriyoshi
On Wed, 25 Dec 2002, Moriyoshi Koizumi wrote:moriyoshi Wed Dec 25 15:00:14 2002 EDTModified files: (Branch: PHP_4_3) /php4/ext/standard array.c Log:Fixed bug #21182 Index: php4/ext/standard/array.c diff -u php4/ext/standard/array.c:1.199.2.9 php4/ext/standard/array.c:1.199.2.10 --- php4/ext/standard/array.c:1.199.2.9 Fri Dec 6 12:36:25 2002 +++ php4/ext/standard/array.c Wed Dec 25 15:00:12 2002 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: array.c,v 1.199.2.9 2002/12/06 17:36:25 iliaa Exp $ */ +/* $Id: array.c,v 1.199.2.10 2002/12/25 20:00:12 moriyoshi Exp $ */ #include "php.h" #include "php_ini.h" @@ -1429,18 +1429,17 @@ array_init(return_value); if (Z_TYPE_PP(zlow)==IS_STRING && Z_TYPE_PP(zhigh)==IS_STRING) { - char *low, *high; - convert_to_string_ex(zlow); - convert_to_string_ex(zhigh); - low = Z_STRVAL_PP(zlow); - high = Z_STRVAL_PP(zhigh); - if (*low>*high) { - for (; *low >= *high; (*low)--) { - add_next_index_stringl(return_value, low, 1, 1); + unsigned char low, high; + low = *((unsigned char *)Z_STRVAL_PP(zlow)); + high = *((unsigned char *)Z_STRVAL_PP(zhigh)); + + if (low>high) { + for (; low >= high; (low)--) { + add_next_index_stringl(return_value, (char *)&low, 1, 1); } } else { - for (; *low <= *high; (*low)++) { - add_next_index_stringl(return_value, low, 1, 1); + for (; low <= high; (low)++) { + add_next_index_stringl(return_value, (char *)&low, 1, 1); } } } else { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-Andrei http://www.gravitonic.com/"C combines all the power of assembly language with all the ease of use of assembly language" -- trad