rjbs / Email-MIME

perl library for parsing MIME messages
20 stars 30 forks source link

do not allow an excessive number of parts #80

Closed rjbs closed 7 months ago

rjbs commented 7 months ago

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

setharnold commented 7 months ago

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