|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-04-15 05:51 UTC] t-yonetani at ergobrains dot co dot jp
Description:
------------
In !defined(PASE) case, _php_db2_bind_data() won't allocate memory area dynamically for a 0-length string, but db2_execute() attempts to efree() it unconditionally in the cleanup code, so it ends up in a SIGSEGV somewhere in efree().
Reproduce code:
---------------
$db = db2_connect($database, $username, $password);
$st = db2_prepare("VALUES CAST(? AS CHAR(10))");
db2_execute($st, array(""));
Expected result:
----------------
successfully terminate
Actual result:
--------------
PHP catches SIGSEGV
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 01:00:01 2025 UTC |
Hi, Please apply following patch and see if it helps: 3967c3967,3969 < efree((prev_ptr->value)->value.str.val); --- > if((prev_ptr->value)->value.str.val != NULL && (prev_ptr->value)->value.str.len != 0) { > efree((prev_ptr->value)->value.str.val); > } 3970,3971c3972,3975 < if( prev_ptr->param_type != DB2_PARAM_OUT && prev_ptr->param_type != DB2_PARAM_INOUT ){ < efree(prev_ptr->value); --- > if( prev_ptr->param_type != DB2_PARAM_OUT && prev_ptr->param_type != DB2_PARAM_INOUT ) { > if(prev_ptr->value != NULL) { > efree(prev_ptr->value); > } Regards, Ambrish Bhargava