php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61649 zend gc should not mark persistent hashtable
Submitted: 2012-04-06 12:17 UTC Modified: 2012-04-09 13:58 UTC
From: laruence@php.net Assigned: dmitry (profile)
Status: Wont fix Package: Scripting Engine problem
PHP Version: 5.3.10 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: laruence@php.net
New email:
PHP Version: OS:

 

 [2012-04-06 12:17 UTC] laruence@php.net
Description:
------------
zend gc was introducted in 5.3

thinking of a zval which is a Hashtable allocated by a extension in persistent, 
and it also has hashtable children in it,

then , if the extension return this to php script:

array_init(return_value);
zend_hash_copy(Z_ARRVAL_P(return_value), Z_ARRVAL_P(persitent_zval_hashtable), 
***)..

since zval_copy_ctor does shallow copy, so the persistent array return to the 
php 
script.


then if it happen to be parsed by zval_ptr_dtor, then the persistent array will 
be 
parsed by gc_zval_possible_root,

ZEND_API void gc_zval_possible_root(zval *zv TSRMLS_DC)
{ 

..................
         
    if (GC_ZVAL_GET_COLOR(zv) != GC_PURPLE) {
        GC_ZVAL_SET_PURPLE(zv);
..................

then the malloc info of the block(not sure before or after) will be polluted.

then when the extension try to free the block,  a warning will be show like:

munmap_chunk(): invalid pointer 0x*******




Test script:
---------------
none

Expected result:
----------------
none

Actual result:
--------------
none

Patches

bug61649.patch (last revision 2012-04-06 12:18 UTC by laruence@php.net)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-06 12:18 UTC] laruence@php.net
The following patch has been added/updated:

Patch Name: bug61649.patch
Revision:   1333714735
URL:        https://bugs.php.net/patch-display.php?bug=61649&patch=bug61649.patch&revision=1333714735
 [2012-04-06 12:22 UTC] laruence@php.net
dmitry, could you plz look at this, thanks :)
 [2012-04-06 12:22 UTC] laruence@php.net
-Assigned To: +Assigned To: dmitry
 [2012-04-09 13:58 UTC] laruence@php.net
-Status: Assigned +Status: Wont fix
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Apr 30 03:01:27 2025 UTC