|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72324 imap_mailboxmsginfo() return wrong size
Submitted: 2016-06-03 08:50 UTC Modified: 2017-07-07 06:18 UTC
From: ronaldpoon at udomain dot com dot hk Assigned: kalle (profile)
Status: Closed Package: IMAP related
PHP Version: Irrelevant OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
33 - 9 = ?
Subscribe to this entry?

 [2016-06-03 08:50 UTC] ronaldpoon at udomain dot com dot hk
When mailbox or subfolder larger than 4G, the imap_mailboxmsginfo() will return wrong size. It is because the msize for accumulate the RFC822.SIZE overflow beyond 4G due to 32bit integer. By changing the unsigned int to unsigned long, the msize will be calculated correctly.

--- ext/imap/php_imap.c.orig    2016-06-03 16:39:44.387619879 +0800
+++ ext/imap/php_imap.c 2016-06-03 16:40:10.484287296 +0800
@@ -2601,7 +2601,7 @@ PHP_FUNCTION(imap_mailboxmsginfo)
        zval *streamind;
        pils *imap_le_struct;
        char date[100];
-       unsigned int msgno, unreadmsg, deletedmsg, msize;
+       unsigned long msgno, unreadmsg, deletedmsg, msize;
        if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &streamind) == FAILURE) {


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-08-20 00:36 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: kalle
 [2017-07-07 06:18 UTC]
-Status: Assigned +Status: Closed
 [2017-07-07 06:18 UTC]
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at

 For Windows:
Thank you for the report, and for helping us make PHP better.

 [2017-07-07 06:19 UTC]
Automatic comment on behalf of kalle
Log: Fixed bug #72324 (imap_mailboxmsginfo() return wrong size)
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Jun 21 02:01:24 2021 UTC