#41134 [Opn->Csd]: zend_ts_hash_clean not thread-safe

From: Date: Fri, 11 May 2007 12:21:33 +0000
Subject: #41134 [Opn->Csd]: zend_ts_hash_clean not thread-safe
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112544@lists.php.net to get a copy of this message
ID: 41134 Updated by: tony2001@php.net Reported By: marco dot cova at gmail dot com -Status: Open +Status: Closed Bug Type: Scripting Engine problem PHP Version: 5.2.1 New Comment: This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2007-04-18 15:11:58] marco dot cova at gmail dot com Description: ------------ It seems that zend_ts_hash_clean is not actually thread-safe: it delegates to zend_hash_clean without first acquiring the write lock on the hashtable. The following patch should fix this. --- zend_ts_hash.c.orig 2007-04-16 10:27:24.000000000 -0700 +++ zend_ts_hash.c 2007-04-16 10:28:44.000000000 -0700 @@ -90,8 +90,10 @@ ZEND_API void zend_ts_hash_clean(TsHashTable *ht) { + begin_write(ht); ht->reader = 0; zend_hash_clean(TS_HASH(ht)); + end_write(ht); } ZEND_API int _zend_ts_hash_add_or_update(TsHashTable *ht, char *arKey, uint nK eyLength, void *pData, uint nDataSize, void **pDest, int flag ZEND_FILE_LINE_DC ) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41134&edit=1

« previous php.bugs (#112544) next »