|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-07-22 15:30 UTC] zeev@php.net
[2002-02-03 20:19 UTC] yohgaki@php.net
[2002-03-04 00:00 UTC] php-bugs at lists dot php dot net
[2002-07-24 14:42 UTC] zimpel at t-online dot de
[2002-07-24 20:08 UTC] sniper@php.net
[2002-08-25 01:00 UTC] php-bugs at lists dot php dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 18:00:01 2025 UTC |
The crash may be only reproducible in release builds with activated bcmath. (In debug builds the Zend efree() function returns prior actual freeing something, if the thread which calls efree() isn't the thread which original allocated the resource). The "call stack" of this issue is: php_module_shutdown_wrapper() // pi3web_sapi.c php_module_shutdown() // main.c zend_shutdown() // zend.c zend_hash_destroy(&module_registry) // zend_hash.c pefree(ht->arBuckets, ht->persistent) // zend_hash.c ... PHP_MSHUTDOWN_FUNCTION(bcmath) // bcmath.c bc_free_num (num) // init.c, the global bcnum value is _two_ efree ((*num)->n_ptr); // zend_alloc.c In efree() the code in macro REMOVE_POINTER_FROM_LIST() crashes #define REMOVE_POINTER_FROM_LIST(p) \ if (!p->persistent && p==AG(head)) { \ AG(head) = p->pNext; \ } else if (p->persistent && p==AG(phead)) { \ AG(phead) = p->pNext; \ } else { \ p->pLast->pNext = p->pNext; \ } \ if (p->pNext) { \ p->pNext->pLast = p->pLast; \ } The reason of the crash is } else { \ p->pLast->pNext = p->pNext; \ if the pointer pLast == NULL. This is true for the last allocated persistent resource. This code is only called when bcmath performs shutdown, because in other calls of efree() the condition p==AG(head) seems to be always true. A probable fix is: } else if (p->pLast) { \ p->pLast->pNext = p->pNext; \ --- regards, Holger Zimmermann