Re: cvs: php-src(PHP_5_2) /ext/imap php_imap.c

From: Date: Fri, 16 Feb 2007 02:04:46 +0000
Subject: Re: cvs: php-src(PHP_5_2) /ext/imap php_imap.c
References: 1 2  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-43082@lists.php.net to get a copy of this message
What version of c-client are you using? For me here the code does not show any errors via valgrind 3.2.3. On 15-Feb-07, at 3:04 PM, Antony Dovgal wrote:
On 02/13/2007 11:12 PM, Ilia Alshanetsky wrote:
http://cvs.php.net/viewvc.cgi/php-src/ext/imap/php_imap.c?r1=1.208.2.7.2.16&r2=1.208.2.7.2.17&diff_format=u Index: php-src/ext/imap/php_imap.c diff -u php-src/ext/imap/php_imap.c:1.208.2.7.2.16 php-src/ext/imap/php_imap.c:1.208.2.7.2.17 --- php-src/ext/imap/php_imap.c:1.208.2.7.2.16 Thu Jan 18 14:03:38 2007 +++ php-src/ext/imap/php_imap.c Tue Feb 13 20:12:52 2007 @@ -26,7 +26,7 @@
    | PHP 4.0 updates:  Zeev Suraski <zeev@zend.com>                       |
    +----------------------------------------------------------------------+
*/ -/* $Id: php_imap.c,v 1.208.2.7.2.16 2007/01/18 14:03:38 tony2001 Exp $ */ +/* $Id: php_imap.c,v 1.208.2.7.2.17 2007/02/13 20:12:52 iliaa Exp $ */ #define IMAP41 @@ -2215,6 +2215,9 @@ if (dest.data) { free(dest.data); } + if (src.data) { + free(src.data); + } } /* }}} */
This is what I see after this patch (confirmed by Hannes): # ./sapi/cli/php -r 'var_dump(imap_utf8(""));' *** glibc detected *** double free or corruption (fasttop): 0x08458658 *** Aborted ==8685== Invalid free() / delete / delete[]
==8685==    at 0x401D297: free (vg_replace_malloc.c:233)
==8685==    by 0x8106713: zif_imap_utf8 (php_imap.c:2219)
==8685==    by 0x828ED19: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==8685==    by 0x8291D3F: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1681)
==8685==    by 0x828E92C: execute (zend_vm_execute.h:92)
==8685==    by 0x8263860: zend_eval_string (zend_execute_API.c:1151)
==8685==    by 0x82639C0: zend_eval_string_ex (zend_execute_API.c:1185)
==8685==    by 0x82D5B83: main (php_cli.c:1160)
==8685== Address 0x4708D90 is 0 bytes inside a block of size 1 free'd
==8685==    at 0x401D297: free (vg_replace_malloc.c:233)
==8685==    by 0x81066FF: zif_imap_utf8 (php_imap.c:2216)
==8685==    by 0x828ED19: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:200)
==8685==    by 0x8291D3F: ZEND_DO_FCALL_SPEC_CONST_HANDLER (zend_vm_execute.h:1681)
==8685==    by 0x828E92C: execute (zend_vm_execute.h:92)
==8685==    by 0x8263860: zend_eval_string (zend_execute_API.c:1151)
==8685==    by 0x82639C0: zend_eval_string_ex (zend_execute_API.c:1185)
==8685==    by 0x82D5B83: main (php_cli.c:1160)
--Wbr, Antony Dovgal
Ilia Alshanetsky

« previous php.cvs (#43082) next »