Re: cvs: php-src(PHP_5_2) /ext/standard string.c
| From: | Antony Dovgal | Date: | Tue, 29 Aug 2006 13:07:48 +0000 |
| Subject: | Re: cvs: php-src(PHP_5_2) /ext/standard string.c | ||
| References: | 1 2 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-40156@lists.php.net to get a copy of this message | ||
On 29.08.2006 16:54, Stefan Esser wrote:
Your imagination is just fabulous. "so please think twice before optimizing" means "be careful and do not try to optimize this code, even though it looks like it can be optimized by moving the emalloc() call to the beginning of the function". Please try to understand what I've really said before posting your comments again. -- Wbr, Antony Dovgalfix win32 build EG(precision) can be changed in runtime, even in php_implode() (hint: __toString()), so please think twice before optimizing ... case IS_DOUBLE: { - char stmp[MAX_LENGTH_OF_DOUBLE + EG(precision) + 1]; + char *stmp; + stmp = emalloc(MAX_LENGTH_OF_DOUBLE + EG(precision) + 1); str_len = sprintf(stmp, "%.*G", (int) EG(precision), Z_DVAL_PP(tmp)); smart_str_appendl(&implstr, stmp, str_len); + efree(stmp);Well as usual critizicing the commits of others but not seeing the obvious integer overflow in memory allocation in your own commit...