Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not allow an excessive number of parts #80

Merged
merged 3 commits into from
May 2, 2024
Merged

Conversation

rjbs
Copy link
Owner

@rjbs rjbs commented Apr 23, 2024

This is annoying! It bugs me that making a mere 100,000 parts should lead to excessive consumption of memory… but really, nobody does that for a good reason.

This makes top-level (non-recursive) Email::MIME->new set a localized part counter to 0 and increment before it makes new subpart objects. If the counter exceeds the max, it will die early.

It would be better to work, but this is better than eating all memory and crashing, right?

Put together with help from Marc Bradshaw.

Test forthcoming.

Fixes #66

This is annoying!  It bugs me that making a mere 100,000 parts should lead
to excessive consumption of memory… but really, nobody does that for
a good reason.

This makes top-level (non-recursive) Email::MIME->new set a localized
part counter to 0 and increment before it makes new subpart objects.
If the counter exceeds the max, it will die early.

It would be better to work, but this is better than eating all memory and
crashing, right?

Put together with help from Marc Bradshaw.

Test forthcoming.
@setharnold
Copy link

I'm by no means an expert on the codebase but I like what I see. I understand the frustration :) but this feels very pragmatic. Thanks

@rjbs rjbs force-pushed the issue-66-too-many-parts branch from c249130 to 3dcf096 Compare May 2, 2024 18:53
@rjbs rjbs merged commit 88cfc99 into main May 2, 2024
44 checks passed
@rjbs rjbs deleted the issue-66-too-many-parts branch May 2, 2024 21:10
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.

DoS on excessive or deeply nested parts
2 participants