#37253 [Opn->Bgs]: arguments in macro 'safe_emalloc'
ID: 37253
Updated by: iliaa@php.net
Reported By: bernard dot theis at laposte dot net
-Status: Open
+Status: Bogus
Bug Type: Unknown/Other Function
Operating System: all
PHP Version: 5.1.2
New Comment:
The order of the 1st and 2nd parameter to this macro really
does not matter.
Previous Comments:
------------------------------------------------------------------------
[2006-04-30 23:14:45] bernard dot theis at laposte dot net
Description:
------------
Hello,
Please, take a look in the arguments used with the maco 'safe_emalloc',
specially, in file 'ext/standard/array.c'
In function PHP_FUNCTION(min):
safe_emalloc(sizeof(zval **), ZEND_NUM_ARGS(), 0)
In function PHP_FUNCTION(max):
safe_emalloc(sizeof(zval **), ZEND_NUM_ARGS(), 0);
The first and the second arg are inversed (fortunately, they are
commutative):
ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset
.... );
thanks,
Bernard
Reproduce code:
---------------
zval ***args = (zval ***) safe_emalloc(sizeof(zval **),
ZEND_NUM_ARGS(), 0);
zval **min, result;
int i;
Expected result:
----------------
zval ***args = (zval ***) safe_emalloc(ZEND_NUM_ARGS(), sizeof(zval
**), 0);
zval **min, result;
int i;
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37253&edit=1
Thread (2 messages)