It seems that messages with no body cause a segfault in dbmail-imapd when retrieving mail with fetchmail. A section of the log is below:

Nov 29 11:42:22 mag dbmail/imap4[98425]: COMMAND: [A0007 FETCH 1 BODY.PEEK[TEXT]]
Nov 29 11:42:22 mag dbmail/imap4[98425]: arg[0]: '1'
Nov 29 11:42:22 mag dbmail/imap4[98425]: arg[1]: 'BODY.PEEK'
Nov 29 11:42:22 mag dbmail/imap4[98425]: arg[2]: '['
Nov 29 11:42:22 mag dbmail/imap4[98425]: arg[3]: 'TEXT'
Nov 29 11:42:22 mag dbmail/imap4[98425]: arg[4]: ']'
Nov 29 11:42:22 mag dbmail/imap4[98425]: imap_process(): Executing command fetch... Nov 29 11:42:22 mag dbmail/imap4[98425]: db_query(): executing query [SELECT permission,seen_flag,answered_flag,deleted_flag,flagged
_flag,recent_flag,draft_flag  FROM mailboxes WHERE mailbox_idnr = 1172::bigint]
Nov 29 11:42:22 mag dbmail/imap4[98425]: db_query(): executing query [SELECT message_idnr, seen_flag, recent_flag FROM messages WHER E mailbox_idnr = 1172::bigint AND status<2 AND unique_id!='' ORDER BY message_idnr ASC] Nov 29 11:42:22 mag dbmail/imap4[98425]: db_query(): executing query [SELECT message_idnr FROM messages WHERE unique_id!='' ORDER BY
 message_idnr DESC LIMIT 1]
Nov 29 11:42:22 mag dbmail/imap4[98425]: next_fetch_item(): args[idx = 4] = ] (returning 5)
Nov 29 11:42:22 mag dbmail/imap4[98425]: Fetching msgID 474842 (fetch num 1)^M
Nov 29 11:42:22 mag dbmail/imap4[98425]: db_query(): executing query [SELECT messageblk FROM messageblks WHERE message_idnr = 474842
::bigint ORDER BY messageblk_idnr]
Nov 29 11:42:22 mag dbmail/imap4[98425]: db_start_msg(): starting, stopbound: '(null)'
Nov 29 11:42:22 mag dbmail/imap4[98425]: mime_readheader(): entering mime loop
Nov 29 11:42:22 mag dbmail/imap4[98425]: mime_readheader(): found double newline; header size: 21 lines
Nov 29 11:42:22 mag dbmail/imap4[98425]: db_start_msg(): found singlepart msg
Nov 29 11:42:22 mag dbmail/imap4[98425]: db_start_msg(): exit
Nov 29 11:42:22 mag dbmail/imap4[98425]: Dumping range: (1::bigint,0::bigint) - (1::bigint,0::bigint) Nov 29 11:42:22 mag dbmail/imap4[98425]: db_query(): executing query [SELECT messageblk FROM messageblks WHERE message_idnr = 474842
::bigint ORDER BY messageblk_idnr]
Nov 29 11:42:22 mag dbmail/imap4[98425]: db_dump_range(): bad range specified
Nov 29 11:42:22 mag dbmail/imap4[98425]: Received SIGBUS

The reason for the message 'bad range specified' is that the message has no body block, so that the test:

    if (start.block >= PQntuples(res))

in dbmsgbufpgsql.c fails.

This returns -1 to the length in imapcommands.c, which is not checked as far as I can tell. As a result it sends "-1" formatted as an unsigned long long as the message length, and dies when it tries to read the buffer.

Any help (or patches!) would be greatly appreciated. Perhaps this is a problem with the storage system, or even the mail that allows empty bodies.




----------------------------------------------------------------
Philip Warner                    |     __---_____
Albatross Consulting Pty. Ltd.   |----/       -  \
(A.B.N. 75 008 659 498)          |          /(@)   ______---_
Tel: (+61) 0500 83 82 81         |                 _________  \
Fax: (+61) 03 5330 3172          |                 ___________ |
Http://www.rhyme.com.au          |                /           \|
                                 |    --________--
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/

Reply via email to