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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bernard dot theis at laposte dot net
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 01:01:32 2025 UTC