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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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)

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 07:01:31 2024 UTC