php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37253 arguments in macro 'safe_emalloc'
Submitted: 2006-04-30 23:14 UTC Modified: 2006-05-11 21:28 UTC
From: bernard dot theis at laposte dot net Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.1.2 OS: all
Private report: No CVE-ID: None
 [2006-04-30 23:14 UTC] 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;




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-11 21:28 UTC] iliaa@php.net
The order of the 1st and 2nd parameter to this macro really 
does not matter.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 13:01:33 2024 UTC