Bug#923283: dovecot-sieve: panic in i_stream_concat_close: assertion failed: (cstream->cur_input == cstream->input[cstream->cur_idx])

2019-04-11 Thread Timo Sirainen
On 26 Feb 2019, at 9.20, Graham Cobb  wrote:
> 
> When processing a particular type of notification email, I consistently get 
> the
> following sieve crash during execution of /usr/lib/dovecot/dovecot-lda.
> (note, extracted from mail.log and reformatted a little for readability)
> 
> Feb 25 19:22:46 black dovecot: lda(cobb)<7721>: 
> Panic: file istream-concat.c:
> line 25 (i_stream_concat_close): assertion failed: (cstream->cur_input == 
> cstream->input[cstream->cur_idx])
..
> The actual line in the sieve script being executed at the time of the crash 
> is the first line of
> the following (the test would not be satisfied on this message):
> 
> if body :raw :contains "://docs.google.com" {
>addheader "X-GRC-SIEVE-Message" "Deleted by Google Docs low 
> tolerance filter";
>   fileinto "${spam_medium}";
>   stop;
>}
> 
> If I comment out that test, or even just remove the ":raw" clause, the script 
> executes.
> However a small script just containing that test does not crash.
> 
> I would rather not attach the full scripts to this report, but can provide 
> them to the
> maintainer if required.

Is this still happening? Could you send me/Stephan the full Sieve script that 
causes the crash? As you said, it's not enough to cause the crash with just 
that small snippet.



Bug#923283: dovecot-sieve: panic in i_stream_concat_close: assertion failed: (cstream->cur_input == cstream->input[cstream->cur_idx])

2019-02-25 Thread Graham Cobb
Package: dovecot-sieve
Version: 1:2.3.4.1-1
Severity: normal

When processing a particular type of notification email, I consistently get the
following sieve crash during execution of /usr/lib/dovecot/dovecot-lda.
(note, extracted from mail.log and reformatted a little for readability)

Feb 25 19:22:46 black dovecot: lda(cobb)<7721>: Panic: 
file istream-concat.c:
line 25 (i_stream_concat_close): assertion failed: (cstream->cur_input == 
cstream->input[cstream->cur_idx])
Feb 25 19:22:46 black dovecot: lda(cobb)<7721>: Error: 
Raw backtrace:
 /usr/lib/dovecot/libdovecot.so.0(+0xdad0b) [0x7faa1caead0b] ->
 /usr/lib/dovecot/libdovecot.so.0(+0xdad71) [0x7faa1caead71] ->
 /usr/lib/dovecot/libdovecot.so.0(+0x4a19f) [0x7faa1ca5a19f] ->
 /usr/lib/dovecot/libdovecot.so.0(+0x4c185) [0x7faa1ca5c185] ->
 /usr/lib/dovecot/libdovecot.so.0(io_stream_unref+0x27) [0x7faa1caf3a07] ->
 /usr/lib/dovecot/libdovecot.so.0(i_stream_unref+0x1d) [0x7faa1caf697d] ->
 /usr/lib/dovecot/libdovecot-storage.so.0(index_storage_mailbox_close+0x69) 
[0x7faa1cc76b79] ->
 /usr/lib/dovecot/libdovecot-storage.so.0(mailbox_close+0x24) [0x7faa1cbf9ed4] 
->
 /usr/lib/dovecot/libdovecot-storage.so.0(mailbox_free+0x13) [0x7faa1cbf9f43] ->
 /usr/lib/dovecot/dovecot-lda(main+0x756) [0x5626a8ac6dd6] ->
 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xeb) [0x7faa1c81c09b] ->
 /usr/lib/dovecot/dovecot-lda(_start+0x2a) [0x5626a8ac747a]

I can reproduce the crash consistently with a particular type of message being
delivered to a particular account with a fairly large set of sieve scripts.
I have managed to reduce the message to a small test message but I have not been
able to reproduce the crash with a significantly simpler script.

The actual line in the sieve script being executed at the time of the crash is 
the first line of
the following (the test would not be satisfied on this message):

  if body :raw :contains "://docs.google.com" {
addheader "X-GRC-SIEVE-Message" "Deleted by Google Docs low 
tolerance filter";
fileinto "${spam_medium}";
stop;
}

If I comment out that test, or even just remove the ":raw" clause, the script 
executes.
However a small script just containing that test does not crash.

I would rather not attach the full scripts to this report, but can provide them 
to the
maintainer if required.

The test message to reproduce the crash is:

>From ...@xxx.com  Thu Feb 21 23:33:46 2019
Delivered-To: x...@.uk.net
Return-Path: 
X-Original-To: xxwhois_grcxxx@localhost
Delivered-To: x...@.uk.net
To: xx...@.com
Subject: 
xxx
From: xx xx - xxx xxx 
Content-Type: text/plain; charset=utf-8
Message-Id: <20190221232525.e87682ed2...@xxx.com>
Date: Thu, 21 Feb 2019 23:25:25 + (GMT)

Test message



-- Package-specific info:

dovecot configuration
-
# 2.3.4.1 (f79e8e7e4): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.4 ()
# OS: Linux 4.19.0-2-amd64 x86_64 Debian buster/sid 
# Hostname: black.home.cobb.me.uk
log_timestamp = "%Y-%m-%d %H:%M:%S "
login_trusted_networks = 192.168.0.0/16 127.0.0.1
mail_location = maildir:~/dovecot:INDEX=/var/indexes/%u
mail_max_userip_connections = 50
mail_privileged_group = mail
maildir_stat_dirs = yes
namespace {
  hidden = yes
  inbox = no
  list = children
  location = mbox:~/mail
  prefix = "#mbox/"
  separator = /
  type = private
}
namespace inbox {
  inbox = yes
  location = 
  mailbox Drafts {
special_use = \Drafts
  }
  mailbox Junk {
special_use = \Junk
  }
  mailbox Sent {
special_use = \Sent
  }
  mailbox "Sent Messages" {
special_use = \Sent
  }
  mailbox Trash {
special_use = \Trash
  }
  prefix = 
  separator = /
}
passdb {
  driver = pam
}
passdb {
  args = scheme=SSHA512 username_format=%n /etc/dovecot/users
  driver = passwd-file
}
plugin {
  sieve = file:~/sieve;active=~/.dovecot.sieve
  sieve_extensions = +editheader +vnd.dovecot.debug
}
postmaster_address = postmas...@cobb.uk.net
protocols = " imap"
service imap {
  process_limit = 100
}
service pop3 {
  process_limit = 100
}
ssl_cert = 
pn  dovecot-gssapi 
ii  dovecot-imapd  1:2.3.4.1-1
pn  dovecot-ldap   
pn  dovecot-lmtpd  
pn  dovecot-managesieved   
pn  dovecot-mysql  
pn  dovecot-pgsql  
pn  dovecot-pop3d  
ii  dovecot-sieve  1:2.3.4.1-1
pn  dovecot-sqlite 

-- no debconf information