Re: zend_hash_add_or_update flaw

From: Date: Wed, 06 Dec 2000 20:17:34 +0000
Subject: Re: zend_hash_add_or_update flaw
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-40248@lists.php.net to get a copy of this message
I don't quite understand what flaw you are talking about. pDataPtr is a void *. If the size of the data we are receiving is the same size of pDataPtr (sizeof(void *)) we copy it's value to pDataPtr. I don't see why doing it via a cast doesn't work. It should work on all platforms. pDataPtr = *(void **)pData (where pData is the size of void *). What your patch does isn't fixing a flaw (unless I'm missing something) but adding functionality by using pDataPtr even if pData is smaller than void *. If I'd know that on all systems memcpy() is as fast as doing it with a cast I wouldn't mind the patch but I am pretty sure it isn't. Andi At 07:16 PM 12/6/00 +0100, Sascha Schumann wrote:
    Hi,
    the OnUpdateTags function exposed an apparent flaw in
    zend_hash_add_or_update(). The macro INIT_DATA assumes that a
    data element of the size sizeof(void *) is always a pointer
    to a pointer and tries to dereference it.
    The attached patch fixes that flaw and uses pDataPtr to
    generally speed up storage of small elements.
    Comments?
    - Sascha
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
--- Andi Gutmans <andi@zend.com> http://www.zend.com/

« previous php.dev (#40248) next »