#24386 [Fbk->Opn]: Segmentation fault in imap_headerinfo
| From: | arcten at pop dot co dot za | Date: | Sun, 29 Jun 2003 17:25:48 +0000 |
| Subject: | #24386 [Fbk->Opn]: Segmentation fault in imap_headerinfo | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-42737@lists.php.net to get a copy of this message | ||
ID: 24386
User updated by: arcten at pop dot co dot za
Reported By: arcten at pop dot co dot za
-Status: Feedback
+Status: Open
Bug Type: IMAP related
Operating System: Linux - Slackware 8.0
PHP Version: 4CVS-2003-06-29 (stable)
New Comment:
$ gdb /usr/bin/php core
(gdb) print tmp->personal
Cannot access memory at address 0x616d7568
(gdb)
Previous Comments:
------------------------------------------------------------------------
[2003-06-29 12:04:51] iliaa@php.net
Can you print the value of tmp->personal
------------------------------------------------------------------------
[2003-06-29 11:45:13] arcten at pop dot co dot za
Description:
------------
When opening a IMAP stream to a POP3 server, and running a
imap_headerinfo on a message, PHP gives a segmentation fault.
I found a few other bugs that looked similar to this one:
http://bugs.php.net/bug.php?id=22048
http://bugs.php.net/bug.php?id=19280
Tested on:
PHP-4.3.0
PHP-4.3.2
PHP4-STABLE-200306291330
IMAP versions:
IMAP-2002d
IMAP-2001-RC1
PHP configure:
'./configure' '--prefix=/usr' '--with-apxs=/usr/sbin/apxs'
'--with-config-file-path=/etc/apache' '--enable-safe-mode'
'--with-openssl' '--enable-bcmath' '--with-bz2'
'--enable-calendar'
'--enable-ctype' '--with-gdbm' '--with-db2' '--enable-dbase'
'--enable-ftp' '--with-mysql=/usr/local/mysql' '--with-gd=/usr/local'
'--with-jpeg-dir=/usr' '--with-png-dir=/usr/'
'--with-xpm-dir=/usr/X11R6' '--with-zlib=/usr'
'--with-ttf=/usr/X11R6/include/freetype' '--enable-xslt'
'--with-xslt-sablot=/usr/local' '--with-expat-dir=/usr/local'
'--with-dom=/usr/local' '--with-dom-xslt=/usr/local'
'--with-dom-exslt=/usr/local' '--with-pgsql=/usr/local/pgsql'
'--with-interbase=/opt/interbase' '--disable-magic-quotes'
'--with-curl=/usr' '--with-imap=/usr/local/imap-2002d'
'--enable-debug'
Reproduce code:
---------------
header('Content-type: text/plain');
$mbox = imap_open('{localhost:110/pop3}', 'user', 'password');
$numMsg = imap_num_msg($mbox);
for($i = 1; $i <= $numMsg; $i++)
{
$header = imap_headerinfo($mbox, $i);
print_r($header);
}
imap_close($mbox);
Expected result:
----------------
As an Apache module, nothing appears (Mozilla doesn't update the page,
it just shows the previous non-error rendition of the page).
Command line:
$ php index.php
Segmentation fault (core dumped)
$
Actual result:
--------------
$ gdb /usr/bin/php core
// loads libraries
#0 0x80cd796 in _php_imap_address_size (addresslist=0x835e768) at
/home/src/php/php-4.3.2/ext/imap/php_imap.c:3619
3619 ret += _php_rfc822_len(tmp->personal);
(gdb) bt
#0 0x80cd796 in _php_imap_address_size (addresslist=0x835e768) at
/home/src/php/php-4.3.2/ext/imap/php_imap.c:3619
#1 0x80cd858 in _php_imap_parse_address (addresslist=0x835e768,
fulladdress=0xbfffc4b4, paddress=0x836d3a4)
at /home/src/php/php-4.3.2/ext/imap/php_imap.c:3650
#2 0x80cdd8e in _php_make_header_object (myzvalue=0x835da84,
en=0x836b118) at /home/src/php/php-4.3.2/ext/imap/php_imap.c:3695
#3 0x80c2687 in zif_imap_headerinfo (ht=2, return_value=0x835da84,
this_ptr=0x0, return_value_used=1)
at /home/src/php/php-4.3.2/ext/imap/php_imap.c:1476
#4 0x81e0fd2 in execute (op_array=0x836707c) at
/home/src/php/php-4.3.2/Zend/zend_execute.c:1606
#5 0x81cdec4 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /home/src/php/php-4.3.2/Zend/zend.c:869
#6 0x819220e in php_execute_script (primary_file=0xbffff720) at
/home/src/php/php-4.3.2/main/main.c:1671
#7 0x81e7c87 in main (argc=2, argv=0xbffff7a4) at
/home/src/php/php-4.3.2/sapi/cli/php_cli.c:806
#8 0x4082f2eb in __libc_start_main (main=0x81e6f78 <main>, argc=2,
ubp_av=0xbffff7a4, init=0x8076f90 <_init>, fini=0x8238edc <_fini>,
rtld_fini=0x4000c130 <_dl_fini>, stack_end=0xbffff79c) at
../sysdeps/generic/libc-start.c:129
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24386&edit=1