Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_hash.c

From: Date: Tue, 05 Nov 2002 13:20:01 +0000
Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_hash.c
References: 1  Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-554@lists.php.net to get a copy of this message
First there is the compiler warning about un-initialized variable, which would occur if ordered is null. If that can never happen then this is just a compiler warning fix. If it can happen, then this prevents a possible undefined behaviour because p2 would be used without having it's value set, meaning that that any random value could be in there. Ilia On November 5, 2002 01:27 am, Zeev Suraski wrote: > Hrm, what problem exactly? p2 is not used at all unless ordered is set to > 1... > > At 18:26 04/11/2002, Ilia Alshanetsky wrote: > >iliaa Mon Nov 4 12:26:44 2002 EDT > > > > Modified files: > > /ZendEngine2 zend_hash.c > > Log: > > If ordered is not set a random compiler assigned value of *p2 would be > > used, > > this patch fixes the problem by initializing *p2 to NULL. > > > > > >Index: ZendEngine2/zend_hash.c > >diff -u ZendEngine2/zend_hash.c:1.91 ZendEngine2/zend_hash.c:1.92 > >--- ZendEngine2/zend_hash.c:1.91 Tue Sep 17 10:04:37 2002 > >+++ ZendEngine2/zend_hash.c Mon Nov 4 12:26:44 2002 > >@@ -1163,7 +1163,7 @@ > > > > ZEND_API int zend_hash_compare(HashTable *ht1, HashTable *ht2, > > compare_func_t compar, zend_bool ordered TSRMLS_DC) > > { > >- Bucket *p1, *p2; > >+ Bucket *p1, *p2=NULL; > > int result; > > void *pData2; > > > > > > > > > >-- > >Zend Engine CVS Mailing List (http://cvs.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.zend-engine.cvs (#554) next »