Mailing List Archive

dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <= S->used' failed
that's not funny and leads in multiple crashes and systemd-restart of
dbmail-imapd for two days now and it appears to be triggered by specific
clients because it was away for many hours and started again in the
evening every few minutes

Sep 27 11:09:46 mail systemd: dbmail-imapd.service: main process exited,
code=killed, status=6/ABRT
Sep 27 11:09:46 mail systemd: Unit dbmail-imapd.service entered failed
state.
Sep 27 11:09:46 mail systemd: dbmail-imapd.service failed.
Sep 27 11:09:47 mail systemd: dbmail-imapd.service holdoff time over,
scheduling restart.
Sep 27 11:09:47 mail systemd: Stopping DBMail IMAP Server...
Sep 27 11:09:47 mail systemd: Starting DBMail IMAP Server...
Sep 27 11:09:47 mail systemd: Started DBMail IMAP Server.
Sep 27 11:10:04 mail systemd: dbmail-imapd.service: main process exited,
code=killed, status=6/ABRT
Sep 27 11:10:04 mail systemd: Unit dbmail-imapd.service entered failed
state.
Sep 27 11:10:04 mail systemd: dbmail-imapd.service failed.
Sep 27 11:10:05 mail systemd: dbmail-imapd.service holdoff time over,
scheduling restart.
Sep 27 11:10:05 mail systemd: Stopping DBMail IMAP Server...
Sep 27 11:10:05 mail systemd: Starting DBMail IMAP Server...
Sep 27 11:10:05 mail systemd: Started DBMail IMAP Server.
Sep 27 11:12:25 mail systemd: dbmail-imapd.service: main process exited,
code=killed, status=6/ABRT
Sep 27 11:12:25 mail systemd: Unit dbmail-imapd.service entered failed
state.
Sep 27 11:12:25 mail systemd: dbmail-imapd.service failed.
Sep 27 11:12:26 mail systemd: dbmail-imapd.service holdoff time over,
scheduling restart.
Sep 27 11:12:26 mail systemd: Stopping DBMail IMAP Server...
Sep 27 11:12:26 mail systemd: Starting DBMail IMAP Server...
Sep 27 11:12:26 mail systemd: Started DBMail IMAP Server.

dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.

--

Reindl Harald
the lounge interactive design GmbH
A-1060 Vienna, Hofmühlgasse 17
CTO / CISO / Software-Development
m: +43 (676) 40 221 40, p: +43 (1) 595 3999 33
icq: 154546673, http://www.thelounge.net/

http://www.thelounge.net/signature.asc.what.htm
Re: dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <= S->used' failed [ In reply to ]
Hi All,

I'm encountering the same issue and the problem seems to be the function
"p_string_erase" in "dm_string.c"

The assertion around line 160 fails because the 'len' is bigger than the
S->used (pos is always 0 as far as i've seen).

I'm assuming this is because 'len' represents the line-count for the
operation, and S->used holds the size of the array of parsed lines. My
guess is malformed messages cause the system to believe there are N
lines where there are in fact only M lines available in the array. The
p_string_erase function gets called with a bad / too big argument 'len',
tests the assertion and just exits (which is a huge over-reaction for
production code)

Because I did not have time or the means to analyse the true nature of
the code I've just implemented a dirty workaround and hoped for the
best, which at this point seems to be working just fine. Untill someone
comes up with a true fix I suggest replacing the function with this:

T p_string_erase(T S, size_t pos, int len)

{

assert(S);

assert(pos <= S->used);

// attempted workaround by marius size_t tw=len; if (tw > S->used){
fprintf(stderr, "ASSERT WILL NOW CRASH BUT LETS ATTEMPT A WORKAROUND
[%zu] [%zu] [%u] [%s]\n",S->used,pos,len,S->str); len = S->used; } //
END OF WORKAROUND

if (len < 0)

len = S->used - pos;

else {

assert (pos + len <= S->used);



if (pos + len < S->used)

memmove (S->str + pos, S->str + pos + len, S->used - (pos + len));

}



S->used -= len;



S->str[S->used] = 0;



return S;

}



Regards,
Marius Karthaus
BudgetDedicated.com

Op 27-09-15 om 11:50 schreef Reindl Harald:
> that's not funny and leads in multiple crashes and systemd-restart of
> dbmail-imapd for two days now and it appears to be triggered by
> specific clients because it was away for many hours and started again
> in the evening every few minutes
>
> Sep 27 11:09:46 mail systemd: dbmail-imapd.service: main process
> exited, code=killed, status=6/ABRT
> Sep 27 11:09:46 mail systemd: Unit dbmail-imapd.service entered failed
> state.
> Sep 27 11:09:46 mail systemd: dbmail-imapd.service failed.
> Sep 27 11:09:47 mail systemd: dbmail-imapd.service holdoff time over,
> scheduling restart.
> Sep 27 11:09:47 mail systemd: Stopping DBMail IMAP Server...
> Sep 27 11:09:47 mail systemd: Starting DBMail IMAP Server...
> Sep 27 11:09:47 mail systemd: Started DBMail IMAP Server.
> Sep 27 11:10:04 mail systemd: dbmail-imapd.service: main process
> exited, code=killed, status=6/ABRT
> Sep 27 11:10:04 mail systemd: Unit dbmail-imapd.service entered failed
> state.
> Sep 27 11:10:04 mail systemd: dbmail-imapd.service failed.
> Sep 27 11:10:05 mail systemd: dbmail-imapd.service holdoff time over,
> scheduling restart.
> Sep 27 11:10:05 mail systemd: Stopping DBMail IMAP Server...
> Sep 27 11:10:05 mail systemd: Starting DBMail IMAP Server...
> Sep 27 11:10:05 mail systemd: Started DBMail IMAP Server.
> Sep 27 11:12:25 mail systemd: dbmail-imapd.service: main process
> exited, code=killed, status=6/ABRT
> Sep 27 11:12:25 mail systemd: Unit dbmail-imapd.service entered failed
> state.
> Sep 27 11:12:25 mail systemd: dbmail-imapd.service failed.
> Sep 27 11:12:26 mail systemd: dbmail-imapd.service holdoff time over,
> scheduling restart.
> Sep 27 11:12:26 mail systemd: Stopping DBMail IMAP Server...
> Sep 27 11:12:26 mail systemd: Starting DBMail IMAP Server...
> Sep 27 11:12:26 mail systemd: Started DBMail IMAP Server.
>
> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
> S->used' failed.
> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
> S->used' failed.
> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
> S->used' failed.
> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
> S->used' failed.
> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
> S->used' failed.
> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
> S->used' failed.
> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
> S->used' failed.
> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
> S->used' failed.
> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
> S->used' failed.
> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
> S->used' failed.
> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
> S->used' failed.
> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
> S->used' failed.
> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
> S->used' failed.
> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
> S->used' failed.
> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
> S->used' failed.
> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
> S->used' failed.
> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
> S->used' failed.
> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
> S->used' failed.
> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
> S->used' failed.
> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
> S->used' failed.
>
>
>
> _______________________________________________
> DBmail mailing list
> DBmail@dbmail.org
> http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail
Re: dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <= S->used' failed [ In reply to ]
i just hate it, sometimes a few crashes, sometimes no one for a few days
and sometimes crashes multiple times each hour

dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.
dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
S->used' failed.

Am 12.10.2015 um 20:21 schrieb Marius Karthaus:
> Hi All,
>
> I'm encountering the same issue and the problem seems to be the function
> "p_string_erase" in "dm_string.c"
>
> The assertion around line 160 fails because the 'len' is bigger than the
> S->used (pos is always 0 as far as i've seen).
>
> I'm assuming this is because 'len' represents the line-count for the
> operation, and S->used holds the size of the array of parsed lines. My
> guess is malformed messages cause the system to believe there are N
> lines where there are in fact only M lines available in the array. The
> p_string_erase function gets called with a bad / too big argument 'len',
> tests the assertion and just exits (which is a huge over-reaction for
> production code)
>
> Because I did not have time or the means to analyse the true nature of
> the code I've just implemented a dirty workaround and hoped for the
> best, which at this point seems to be working just fine. Untill someone
> comes up with a true fix I suggest replacing the function with this:
>
> T p_string_erase(T S, size_t pos, int len)
>
> {
>
> assert(S);
>
> assert(pos <= S->used);
>
> // attempted workaround by marius size_t tw=len; if (tw > S->used){
> fprintf(stderr, "ASSERT WILL NOW CRASH BUT LETS ATTEMPT A WORKAROUND
> [%zu] [%zu] [%u] [%s]\n",S->used,pos,len,S->str); len = S->used; } //
> END OF WORKAROUND
>
> if (len < 0)
>
> len = S->used - pos;
>
> else {
>
> assert (pos + len <= S->used);
>
>
>
> if (pos + len < S->used)
>
> memmove (S->str + pos, S->str + pos + len, S->used - (pos + len));
>
> }
>
>
>
> S->used -= len;
>
>
>
> S->str[S->used] = 0;
>
>
>
> return S;
>
> }
>
>
>
> Regards,
> Marius Karthaus
> BudgetDedicated.com
>
> Op 27-09-15 om 11:50 schreef Reindl Harald:
>> that's not funny and leads in multiple crashes and systemd-restart of
>> dbmail-imapd for two days now and it appears to be triggered by
>> specific clients because it was away for many hours and started again
>> in the evening every few minutes
>>
>> Sep 27 11:09:46 mail systemd: dbmail-imapd.service: main process
>> exited, code=killed, status=6/ABRT
>> Sep 27 11:09:46 mail systemd: Unit dbmail-imapd.service entered failed
>> state.
>> Sep 27 11:09:46 mail systemd: dbmail-imapd.service failed.
>> Sep 27 11:09:47 mail systemd: dbmail-imapd.service holdoff time over,
>> scheduling restart.
>> Sep 27 11:09:47 mail systemd: Stopping DBMail IMAP Server...
>> Sep 27 11:09:47 mail systemd: Starting DBMail IMAP Server...
>> Sep 27 11:09:47 mail systemd: Started DBMail IMAP Server.
>> Sep 27 11:10:04 mail systemd: dbmail-imapd.service: main process
>> exited, code=killed, status=6/ABRT
>> Sep 27 11:10:04 mail systemd: Unit dbmail-imapd.service entered failed
>> state.
>> Sep 27 11:10:04 mail systemd: dbmail-imapd.service failed.
>> Sep 27 11:10:05 mail systemd: dbmail-imapd.service holdoff time over,
>> scheduling restart.
>> Sep 27 11:10:05 mail systemd: Stopping DBMail IMAP Server...
>> Sep 27 11:10:05 mail systemd: Starting DBMail IMAP Server...
>> Sep 27 11:10:05 mail systemd: Started DBMail IMAP Server.
>> Sep 27 11:12:25 mail systemd: dbmail-imapd.service: main process
>> exited, code=killed, status=6/ABRT
>> Sep 27 11:12:25 mail systemd: Unit dbmail-imapd.service entered failed
>> state.
>> Sep 27 11:12:25 mail systemd: dbmail-imapd.service failed.
>> Sep 27 11:12:26 mail systemd: dbmail-imapd.service holdoff time over,
>> scheduling restart.
>> Sep 27 11:12:26 mail systemd: Stopping DBMail IMAP Server...
>> Sep 27 11:12:26 mail systemd: Starting DBMail IMAP Server...
>> Sep 27 11:12:26 mail systemd: Started DBMail IMAP Server.
>>
>> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
>> S->used' failed.
>> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
>> S->used' failed.
>> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
>> S->used' failed.
>> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
>> S->used' failed.
>> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
>> S->used' failed.
>> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
>> S->used' failed.
>> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
>> S->used' failed.
>> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
>> S->used' failed.
>> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
>> S->used' failed.
>> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
>> S->used' failed.
>> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
>> S->used' failed.
>> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
>> S->used' failed.
>> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
>> S->used' failed.
>> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
>> S->used' failed.
>> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
>> S->used' failed.
>> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
>> S->used' failed.
>> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
>> S->used' failed.
>> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
>> S->used' failed.
>> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
>> S->used' failed.
>> dbmail-imapd: dm_string.c:161: p_string_erase: Assertion `pos + len <=
>> S->used' failed.