php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60558 Invalid read and writes
Submitted: 2011-12-19 04:05 UTC Modified: 2011-12-19 16:49 UTC
From: laruence@php.net Assigned: laruence
Status: Closed Package: Scripting Engine problem
PHP Version: 5.4.0RC3 OS:
Private report: No CVE-ID:
 [2011-12-19 04:05 UTC] laruence@php.net
Description:
------------
Valgrind complains about invalid read and writes in the tests:
http://dev.daylessday.org/diff/bug60536_001.mem
http://dev.daylessday.org/diff/bug60536_003.mem

So the problem is definitely not fixed yet.

Test script:
---------------
http://dev.daylessday.org/diff/bug60536_001.mem
http://dev.daylessday.org/diff/bug60536_003.mem


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-12-19 04:07 UTC] laruence@php.net
found while diagnosing #60536
 [2011-12-19 04:53 UTC] laruence@php.net
-Assigned To: +Assigned To: gron
 [2011-12-19 04:53 UTC] laruence@php.net
Gron, ignore the assigment, I just want to get your attention, so let's diag this 
one again :) thanks
 [2011-12-19 04:53 UTC] laruence@php.net
-Assigned To: gron +Assigned To:
 [2011-12-19 08:55 UTC] laruence@php.net
seems something wrong with the refcount of zval in traits's 
default_properties_table[i].  

but I have not figured out what's going wrong. 

A more simple test:
<?php

trait A {
   private $hello = 0;
}

class BaseWithTPropB{
        use A;
}

class SubclassB extends BaseWithTPropB {
        use A;
}

$b = new SubClassB;
var_dump($b);
?>

plz run valgrind like:
USE_ZEND_ALLOC=0  valgrind --db-attach=yes --leak-check=full php test.php
 [2011-12-19 09:58 UTC] laruence@php.net
Automatic comment from SVN on behalf of laruence
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=321158
Log: Fixed bug #60558 (Invalid read and writes)
 [2011-12-19 10:07 UTC] laruence@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: laruence
 [2011-12-19 10:07 UTC] laruence@php.net
This bug has been fixed in SVN.

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/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

ah, worked out, fixed :) thanks
 [2011-12-19 12:00 UTC] laruence@php.net
didn't fixed, introduced new memory leak.
 [2011-12-19 12:00 UTC] laruence@php.net
-Status: Closed +Status: Re-Opened
 [2011-12-19 12:46 UTC] laruence@php.net
-Assigned To: laruence +Assigned To: gron
 [2011-12-19 12:46 UTC] laruence@php.net
There must be something difference between traits and class while doing 
inheritance, but I can't figure out,

gron, plz look at this... my previous attempt failed.
 [2011-12-19 13:07 UTC] laruence@php.net
-Assigned To: gron +Assigned To:
 [2011-12-19 13:20 UTC] gron@php.net
Ideally, it should not be different :-/
Will try to find time soon.

Thanks
Stefan
 [2011-12-19 16:47 UTC] laruence@php.net
Automatic comment from SVN on behalf of laruence
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=321166
Log: Fixed bug #60558 (Invalid read and writes)
Re-Fixed bug #60536 (Traits Segfault)
#Thanks to tony2001, I found the previous fix -r321089 is actually not a correct one.
#The key problem there is because the traits didn't correct set the property_info.offset
#for private properties. so here come the new fix.
 [2011-12-19 16:49 UTC] laruence@php.net
-Status: Re-Opened +Status: Closed -Assigned To: +Assigned To: laruence
 [2011-12-19 16:49 UTC] laruence@php.net
This bug has been fixed in SVN.

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/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

Hi, I finally fix this, you might want to  review this fix 
http://svn.php.net/viewvc?view=revision&revision=321166 :) thanks gron.
 [2012-04-18 09:46 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c1d5a5d7ef24546bc272873348ee522da6a54f88
Log: Fixed bug #60558 (Invalid read and writes) Re-Fixed bug #60536 (Traits Segfault) #Thanks to tony2001, I found the previous fix -r321089 is actually not a correct one. #The key problem there is because the traits didn't correct set the property_info.offset #for private properties. so here come the new fix.
 [2012-04-18 09:46 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=5256e7410e20eaa97b3a8f59602281a982587366
Log: Fixed bug #60558 (Invalid read and writes)
 [2012-07-24 23:38 UTC] rasmus@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c1d5a5d7ef24546bc272873348ee522da6a54f88
Log: Fixed bug #60558 (Invalid read and writes) Re-Fixed bug #60536 (Traits Segfault) #Thanks to tony2001, I found the previous fix -r321089 is actually not a correct one. #The key problem there is because the traits didn't correct set the property_info.offset #for private properties. so here come the new fix.
 [2012-07-24 23:38 UTC] rasmus@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=5256e7410e20eaa97b3a8f59602281a982587366
Log: Fixed bug #60558 (Invalid read and writes)
 [2013-11-17 09:34 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c1d5a5d7ef24546bc272873348ee522da6a54f88
Log: Fixed bug #60558 (Invalid read and writes) Re-Fixed bug #60536 (Traits Segfault) #Thanks to tony2001, I found the previous fix -r321089 is actually not a correct one. #The key problem there is because the traits didn't correct set the property_info.offset #for private properties. so here come the new fix.
 [2013-11-17 09:34 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=5256e7410e20eaa97b3a8f59602281a982587366
Log: Fixed bug #60558 (Invalid read and writes)
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 25 07:02:14 2014 UTC