dovecot-2.2-pigeonhole: lib-sieve: message body: Fixed assert fa...
pigeonhole at rename-it.nl
pigeonhole at rename-it.nl
Wed Dec 30 20:39:19 UTC 2015
details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/10951146f74f
changeset: 2186:10951146f74f
user: Stephan Bosch <stephan at rename-it.nl>
date: Wed Dec 30 21:38:16 2015 +0100
description:
lib-sieve: message body: Fixed assert failure occurring when text extraction is attempted on a empty or broken text part.
diffstat:
src/lib-sieve/sieve-message.c | 2 +-
tests/extensions/body/text.svtest | 41 +++++++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 1 deletions(-)
diffs (60 lines):
diff -r 520a75edcf99 -r 10951146f74f src/lib-sieve/sieve-message.c
--- a/src/lib-sieve/sieve-message.c Wed Dec 30 21:36:29 2015 +0100
+++ b/src/lib-sieve/sieve-message.c Wed Dec 30 21:38:16 2015 +0100
@@ -974,7 +974,7 @@
if ( extract_text && body_part->children == NULL &&
!body_part->epilogue ) {
- if ( mail_html2text_content_type_match
+ if ( buf->used > 0 && mail_html2text_content_type_match
(body_part->content_type) ) {
struct mail_html2text *html2text;
diff -r 520a75edcf99 -r 10951146f74f tests/extensions/body/text.svtest
--- a/tests/extensions/body/text.svtest Wed Dec 30 21:36:29 2015 +0100
+++ b/tests/extensions/body/text.svtest Wed Dec 30 21:38:16 2015 +0100
@@ -182,3 +182,44 @@
}
}
+/*
+ * Broken/Empty parts
+ */
+
+test_set "message" text:
+From: Whomever <whoever at example.com>
+To: Someone <someone at example.com>
+Date: Sat, 10 Oct 2009 00:30:04 +0200
+Subject: whatever
+Content-Type: multipart/mixed; boundary=outer
+
+This is a multi-part message in MIME format.
+
+--outer
+Content-Type: text/html
+
+--outer
+Content-Type: text/html; charset=utf-8
+Content-Transfer-Encoding: multipart/related
+Content-Disposition: inline
+
+<html><body>Please say Hello</body></html>
+
+--outer--
+
+This is the end of the outer MIME multipart.
+.
+;
+
+test "Nested Search" {
+ if body :text :contains "Hello" {
+ test_fail "Cannot match empty/broken part";
+ }
+ if body :text :contains ["<html>", "body"] {
+ test_fail "erroneously matched text/html markup";
+ }
+ if body :text :contains "MIME" {
+ test_fail "erroneously matched multipart prologue/epilogue text";
+ }
+}
+
More information about the dovecot-cvs
mailing list