php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25911 imap_mailboxmsginfo causes SIGBUS in Apache
Submitted: 2003-10-19 11:46 UTC Modified: 2003-10-20 07:56 UTC
From: markus at digitaldiversity dot info Assigned:
Status: Not a bug Package: IMAP related
PHP Version: 4.3.3 OS: FreeBSD 5.0
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: markus at digitaldiversity dot info
New email:
PHP Version: OS:

 

 [2003-10-19 11:46 UTC] markus at digitaldiversity dot info
Description:
------------
Apparently there seems to be some problems with imap_mailboxmsginfo(), causing a SIGBUS error in Apache.

My configure-line is

./configure' \
'--with-apxs=/usr/local/apache/bin/apxs' \
'--enable-cli' \
'--with-zlib' \
'--with-bz2' \
'--with-dom' \
'--with-dom-xslt' \
'--with-dom-exslt' \
'--with-expat' \
'--enable-exif' \
'--enable-ftp' \
'--with-jpeg-dir=/usr/local' \
'--with-gd' \
'--with-pgsql' \
'--with-gettext' \
'--with-ldap' \
'--with-mcrypt' \
'--enable-pcntl' \
'--with-pdflib' \
'--enable-sockets' \
'--enable-wddx' \
'--with-openssl' \
'--with-curl' \
'--with-interbase' \
'--with-xmlrpc' \
'--with-yaz' \
'--enable-shmop' \
'--with-imap=/usr/local/imap-2000e' \
'--enable-debug' \

IMAP being imap-uw version 2000e. I've also tried imap-2002d, both of which gave the same error.

I did read about mcrypt being one possible problem, so I updated that to version 2.6.4_1 in the FreeBSD ports collection, but that didn't help either.


Reproduce code:
---------------
<?php

if (($mbox = imap_open('{mail.server:110/pop3}', 'user', 'password')) === FALSE) {

            imap_close($mbox);
            var_dump(imap_errors());

        }

        $check = imap_mailboxmsginfo($mbox);

        imap_close($mbox);

?>

Expected result:
----------------
Nothing happens when running the above code, except 
Apache (1.2.27) crashing with a SIGBUS and a

[Sun Oct 19 18:41:40 2003] [notice] child pid 27550 exit signal Bus error (10)

being left in the Apache error logs.

Actual result:
--------------
The GDB backtrace looks like this:

Program received signal SIGBUS, Bus error.
mail_fetch_structure (stream=0x814dc00, msgno=1, body=0x0, flags=0) at mail.c:1395
1395          hdr[hdrsize] = '\0';      /* tie off header */
(gdb) bt
#0  mail_fetch_structure (stream=0x814dc00, msgno=1, body=0x0, flags=0) at mail.c:1395
#1  0x2829ef1d in zif_imap_mailboxmsginfo (ht=1, return_value=0x8172524, this_ptr=0x0, return_value_used=1)
    at /usr/home/mle/devel/php-4.3.3/ext/imap/php_imap.c:1901
#2  0x2840aa2a in execute (op_array=0x8173424) at /usr/home/mle/devel/php-4.3.3/Zend/zend_execute.c:1616
#3  0x283f92f9 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/home/mle/devel/php-4.3.3/Zend/zend.c:885
#4  0x283c1fe7 in php_execute_script (primary_file=0xbfbff6e0) at /usr/home/mle/devel/php-4.3.3/main/main.c:1723
#5  0x2840fae4 in apache_php_module_main (r=0x816c034, display_source_mode=0)
    at /usr/home/mle/devel/php-4.3.3/sapi/apache/sapi_apache.c:54
#6  0x28410aa0 in send_php (r=0x816c034, display_source_mode=0,
    filename=0x816cc14 "/usr/local/apache/htdocs/Projects/STAY/lib/webmail.extension.php")
    at /usr/home/mle/devel/php-4.3.3/sapi/apache/mod_php4.c:620
#7  0x28410b11 in send_parsed_php (r=0x816c034) at /usr/home/mle/devel/php-4.3.3/sapi/apache/mod_php4.c:635
#8  0x08053b6a in ap_invoke_handler ()
#9  0x08067f26 in process_request_internal ()
#10 0x08067f88 in ap_process_request ()
#11 0x0805f1a8 in child_main ()
#12 0x0805f348 in make_child ()
#13 0x0805f4b1 in startup_children ()
#14 0x0805fa8e in standalone_main ()
#15 0x080602ac in main ()
#16 0x0804ec45 in _start ()


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-10-19 11:49 UTC] markus at digitaldiversity dot info
Oh, I forgot to mention that the imap_status() function works just fine, it's just the imap_mailboxmsginfo() function that causes the SIGBUS.
 [2003-10-20 07:48 UTC] markus at digitaldiversity dot info
Still causes SIGBUS, but I've pinpointed the problem a bit more: If the mailbox is empty, it works like it should, 
but if there are mails in the mailbox, it crashes apache with the said SIGBUS error, with more or less the same backtrace
(#0 being mail_fetch_structure (stream=0x813fe00, msgno=1, body=0x0, flags=0) at mail.c:1395).

Tested version was 4.3.4RC2-dev (php4-STABLE-200310200930).
 [2003-10-20 07:56 UTC] sniper@php.net
The crash happens inside the c-client, so try this:
 ftp://ftp.cac.washington.edu/imap/imap-2003.DEV.tar.Z

If that doesn't work, report this bug to the c-client author.
(We only wrap around that function, and for me, it works fine,
so I guess this is some problem with the imap server you're connecting to and c-client barfs with it)


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 06:01:28 2024 UTC