|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-10-04 15:59 UTC] novicky at aarongroup dot cz
Description:
------------
There is an incorrect session destructor registration. The pointer registered by zend_list_insert points to a memory block which is then released by efree. This can lead to segmentation fault when destructor is called. A proposed patch follows (the same problem is id development branch)
--- php5-STABLE-200510041238/ext/oci8/oci8.c.ORIG 2005-10-04 15:39:42.301952856 +0200
+++ php5-STABLE-200510041238/ext/oci8/oci8.c 2005-10-04 15:40:58.979935427 +0200
@@ -2879,7 +2879,6 @@
)
);
- session->num = zend_list_insert(session, le_session);
session->is_open = 1;
mutex_lock(mx_lock);
@@ -2892,6 +2891,7 @@
}
mutex_unlock(mx_lock);
+ session->num = zend_list_insert(session, le_session);
oci_debug("_oci_open_session new sess=%d user=%s",session->num,username);
return session;
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 06:00:01 2025 UTC |
It is hard to reproduce but working on deallocated memory blocks is extremely dangerous. We had problems with segmentation faults on Sparc/Solaris 9. Have a look on following code coming from oci8.c - first a session pointer is inserted into the list zend_list_insert(), while few lines bellow the session structure is copied into a new location zend_llist_add_element() and the original memory block is deallocated by efree(). Thus destructor applied on list would work on deallocated memory!!! session->num = zend_list_insert(session, le_session); session->is_open = 1; mutex_lock(mx_lock); num_links++; if (!exclusive) { zend_llist_add_element(session_list, session); efree(session); session = (oci_session*) session_list->tail->data; num_persistent++; } mutex_unlock(mx_lock); oci_debug("_oci_open_session new sess=%d user=%s",session->num,username); return session;