|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58421 [PATCH] ZTS build, Segfault and Mem. leak when instantiating OAuth class
Submitted: 2008-11-21 07:11 UTC Modified: 2008-11-22 16:37 UTC
From: Assigned: jawed (profile)
Status: Closed Package: oauth (PECL)
PHP Version: 5_2 CVS-2008-11-21 (dev) OS: Linux
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.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2008-11-21 07:11 UTC]
I've fixed the ZTS build, and the redeclaration of tsrm_ls variable, when using TSRMLS_FETCH_FROM_CTX is used inside SO_METHOD. And when instantiating OAuth class I saw a segfault, because the variable wasn't initialized for the optional argument. Fixing this, I saw a memory leak, because this:
	if(OAUTH(soo_exception_ce)==NULL) {
		OAUTH(soo_exception_ce) = (zend_class_entry *)emalloc(sizeof(zend_class_entry));
OAUTH(soo_exception_ce) = zend_register_internal_class_ex(&soo_ex_ce,zend_exception_get_default(TSRMLS_C),NULL TSRMLS_CC);

See the code below. var_dump($x); still needing a fix.


Reproduce code:

$x = new oauth(1,1); /* segfault + memory leak */
var_dump($x); /* still needing a fix */

Actual result:
#0  0x00000000 in ?? ()
#1  0x082b6e59 in php_var_dump (struc=0x85ee388, level=1, tsrm_ls=0x84d6050) at /home/felipe/dev/php5_2/ext/standard/var.c:135
#2  0x082b719a in zif_var_dump (ht=1, return_value=0x85f9a08, return_value_ptr=0x0, this_ptr=0x0, return_value_used=0, tsrm_ls=0x84d6050) at /home/felipe/dev/php5_2/ext/standard/var.c:186
#3  0x0838a4a2 in zend_do_fcall_common_helper_SPEC (execute_data=0xbf8d8210, tsrm_ls=0x84d6050) at /home/felipe/dev/php5_2/Zend/zend_vm_execute.h:200


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-21 08:03 UTC]
I've updated the patch, it fixes the class handlers issue too.
 [2008-11-21 18:02 UTC]
Spoke to felipe regarding some of the details regarding the patch and it will be applied in the next release.
 [2008-11-22 04:46 UTC]

I modified your patch a bit, namely the placement of the hashtable init but I think I've got the spirit of the patch in place. If you can +1 or -1 the changes I will resolve this bug and plan the next release accordingly.
 [2008-11-22 16:37 UTC]
It's fine now. :)
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Jun 11 02:03:37 2023 UTC