php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41134 zend_ts_hash_clean not thread-safe
Submitted: 2007-04-18 15:11 UTC Modified: 2007-05-11 12:21 UTC
From: marco dot cova at gmail dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.2.1 OS:
Private report: No CVE-ID:
 [2007-04-18 15:11 UTC] 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
)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-11 12:21 UTC] tony2001@php.net
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.


 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 16 22:02:05 2014 UTC