Skip to content

Commit

Permalink
fix: update mailparse to 0.16.1 to fix panic when parsing a message
Browse files Browse the repository at this point in the history
  • Loading branch information
link2xt committed Feb 28, 2025
1 parent 33f96d4 commit 43a3e40
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ iroh = { version = "0.32", default-features = false }
kamadak-exif = "0.6.1"
libc = { workspace = true }
mail-builder = { git = "https://github.com/stalwartlabs/mail-builder", branch = "main", default-features = false }
mailparse = "0.16"
mailparse = "0.16.1"
mime = "0.3.17"
num_cpus = "1.16"
num-derive = "0.4"
Expand Down
13 changes: 13 additions & 0 deletions src/mimeparser/mimeparser_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,19 @@ fn test_mailparse_content_type() {
);
}

/// Test to reproduce
/// <https://github.com/staktrace/mailparse/issues/130>.
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_mailparse_0_16_0_panic() {
let context = TestContext::new_alice().await;
let raw = include_bytes!("../../test-data/message/mailparse-0.16.0-panic.eml");

// There should be an error, but no panic.
assert!(MimeMessage::from_bytes(&context.ctx, &raw[..], None)
.await
.is_err());
}

#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_parse_first_addr() {
let context = TestContext::new().await;
Expand Down
3 changes: 3 additions & 0 deletions test-data/message/mailparse-0.16.0-panic.eml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Content-Type: multipart/mixed; boundary="foobar"

--foobar--

0 comments on commit 43a3e40

Please sign in to comment.