cvs: ZendEngine2 / zend_hash.c

From: Date: Wed, 01 Feb 2006 01:05:17 +0000
Subject: cvs: ZendEngine2 / zend_hash.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-4549@lists.php.net to get a copy of this message
zeev Wed Feb 1 01:05:17 2006 UTC Modified files: /ZendEngine2 zend_hash.c Log: Fix possibility of a wrong element being deleted by zend_hash_del() http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_hash.c?r1=1.127&r2=1.128&diff_format=u Index: ZendEngine2/zend_hash.c diff -u ZendEngine2/zend_hash.c:1.127 ZendEngine2/zend_hash.c:1.128 --- ZendEngine2/zend_hash.c:1.127 Tue Jan 17 12:18:52 2006 +++ ZendEngine2/zend_hash.c Wed Feb 1 01:05:17 2006 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_hash.c,v 1.127 2006/01/17 12:18:52 dmitry Exp $ */ +/* $Id: zend_hash.c,v 1.128 2006/02/01 01:05:17 zeev Exp $ */ #include "zend.h" #include "zend_operators.h" @@ -546,11 +546,11 @@ p = ht->arBuckets[nIndex]; while (p != NULL) { - if ((p->h == h) && - ((p->nKeyLength == 0) || /* Numeric index */ - ((p->nKeyLength == nKeyLength) && - (p->key.type == type) && - (!memcmp(&p->key.u, arKey, realKeyLength))))) { + if ((p->h == h) + && (p->nKeyLength == nKeyLength) + && ((p->nKeyLength == 0) /* Numeric index (short circuits the memcmp()) */ + || ((p->key.type == type) + && !memcmp(&p->key.u, arKey, realKeyLength)))) { HANDLE_BLOCK_INTERRUPTIONS(); if (p == ht->arBuckets[nIndex]) { ht->arBuckets[nIndex] = p->pNext;

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