php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24386 Segmentation fault in imap_headerinfo
Submitted: 2003-06-29 11:45 UTC Modified: 2003-07-04 02:11 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: arcten at pop dot co dot za Assigned:
Status: No Feedback Package: IMAP related
PHP Version: 4CVS-2003-06-29 (stable) OS: Linux - Slackware 8.0
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: arcten at pop dot co dot za
New email:
PHP Version: OS:

 

 [2003-06-29 11:45 UTC] 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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-29 12:04 UTC] iliaa@php.net
Can you print the value of tmp->personal
 [2003-06-29 12:25 UTC] arcten at pop dot co dot za
$ gdb /usr/bin/php core
(gdb) print tmp->personal
Cannot access memory at address 0x616d7568
(gdb)
 [2003-06-29 13:00 UTC] iliaa@php.net
Can you print the contents of the tmp structure or possible make a text file with the complete message that causes the crash?
 [2003-07-04 02:11 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC