Skip to content
Snippets Groups Projects
Commit 57a7d70e authored by Stephan Bosch's avatar Stephan Bosch
Browse files

lib-sieve: message body: Fixed assert failure occurring when text extraction...

lib-sieve: message body: Fixed assert failure occurring when text extraction is attempted on a empty or broken text part.
parent 62c8bcaf
No related branches found
No related tags found
No related merge requests found
...@@ -974,7 +974,7 @@ static void sieve_message_part_save ...@@ -974,7 +974,7 @@ static void sieve_message_part_save
if ( extract_text && body_part->children == NULL && if ( extract_text && body_part->children == NULL &&
!body_part->epilogue ) { !body_part->epilogue ) {
if ( mail_html2text_content_type_match if ( buf->used > 0 && mail_html2text_content_type_match
(body_part->content_type) ) { (body_part->content_type) ) {
struct mail_html2text *html2text; struct mail_html2text *html2text;
......
...@@ -182,3 +182,44 @@ test "Nested Search" { ...@@ -182,3 +182,44 @@ test "Nested Search" {
} }
} }
/*
* Broken/Empty parts
*/
test_set "message" text:
From: Whomever <whoever@example.com>
To: Someone <someone@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";
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.