php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28883 [PATCH] fix for crash during module shutdown
Submitted: 2004-06-22 19:08 UTC Modified: 2005-12-29 01:00 UTC
From: novicky at aarongroup dot cz Assigned: nobbie (profile)
Status: No Feedback Package: Informix related
PHP Version: 5CVS, 4CVS (2005-02-05) 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: novicky at aarongroup dot cz
New email:
PHP Version: OS:

 

 [2004-06-22 19:08 UTC] novicky at aarongroup dot cz
Description:
------------
There is a problem in function ifx_do_close which can lead to crash during module shutdown.
The function ifx_do_close is called during shutdown from list destrucors _close_ifx_link and _close_ifx_plink. If something goes wrong in this function, error reporting is performed and emalloc is called. Calling emalloc is not possible during memory destruction and can cause segfault.
It is necessary to remove all error reporting from ifx_do_close (which is in fact useless).

Here is a patch:

--- ifx.ec.orig	2004-06-01 02:52:14.000000000 +0200
+++ ifx.ec	2004-06-22 18:46:01.000000000 +0200
@@ -295,7 +295,6 @@
 	PARAMETER char *link;
 EXEC SQL END DECLARE SECTION;
 {
-	char *ifx_err = NULL;
 	TSRMLS_FETCH();
 
 	EXEC SQL SET CONNECTION :link;
@@ -310,32 +309,12 @@
 			if (ifx_check() == 0)   {
 				/* DISCONNECT again, after rollback */
 				EXEC SQL DISCONNECT :link;
-				if (ifx_check() < 0)   {
-					IFXG(sv_sqlcode) = SQLCODE;
-					php_error_docref(NULL TSRMLS_CC, E_WARNING, "Disconnect link %s after Automatic Rollback fails (%s)", link, (ifx_err = ifx_error(link)));
 				}
-			}
-			if (ifx_check() < 0)   {
+			else if (ifx_check() < 0)   {
 				/* CLOSE database if rollback or disconnect fails */
 				EXEC SQL CLOSE DATABASE;
-				if (ifx_check() < 0)   {
-					IFXG(sv_sqlcode) = SQLCODE;
-					php_error_docref(NULL TSRMLS_CC, E_WARNING, "Close database fails %s (%s)", link, (ifx_err = ifx_error(link)));
-				}
 			}
 		}
-		else if (SQLCODE < 0)   {
-			IFXG(sv_sqlcode) = SQLCODE;
-			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Disconnect link %s fails (%s)", link, (ifx_err = ifx_error(link)));
-		}
-	}       
-	else   {
-		IFXG(sv_sqlcode) = SQLCODE;
-		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Set connection %s fails (%s)", link, (ifx_err = ifx_error(link)));
-	}
-
-	if (ifx_err) {
-		efree(ifx_err);
 	}
 }
 




Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-21 21:55 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip


 [2005-12-29 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Dec 03 11:03:36 2021 UTC