Skip to content

Ensure all parsed messages have at least one part#121

Open
sftse wants to merge 4 commits intostalwartlabs:mainfrom
sftse:c-dev
Open

Ensure all parsed messages have at least one part#121
sftse wants to merge 4 commits intostalwartlabs:mainfrom
sftse:c-dev

Conversation

@sftse
Copy link
Contributor

@sftse sftse commented Nov 7, 2025

Fixes #120

With corrupted messages the type of the part is a bit arbitrary. Chosen PartType::Binary to be as generic as possible, but PartType::Text could be acceptable as well.

@Piesson
Copy link

Piesson commented Jan 8, 2026

Hey! I ran into this exact same issue while using himalaya to send emails. Got the index out of bounds: the len is 0 but the index is 0 panic at message.rs:89.

Really hoping this gets reviewed and merged soon. Thanks for the fix! 🙏

Piesson added a commit to Piesson/mail-parser that referenced this pull request Jan 8, 2026
Use first_mut() instead of direct array access to safely handle
the case when message.parts is empty. This prevents index out of
bounds panic at message.rs:528.

Based on PR stalwartlabs#121 fix, backported to v0.9.x branch.
Piesson added a commit to Piesson/himalaya that referenced this pull request Jan 8, 2026
Added patch.crates-io entry to use local mail-parser with fix
for index out of bounds panic when message.parts is empty.

Related: stalwartlabs/mail-parser#121
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The library will panic with messages containing corrupted eml attachments

2 participants