The reader walks the MIME tree with its container context: alternative picks versions, related finds its root by start, attached multiparts stay whole, digest children are messages. Nesting deeper than 64 levels, counting enclosed messages, is refused, and over-deep parse results are taken apart iteratively so dropping them cannot overflow the stack. Composite parts with a Content-ID are cid targets. The writer keeps attachment parameters and Content-IDs, writes multipart and message attachments unencoded, and makes its own Message-ID. SMTP adds BODY=8BITMIME for 8-bit bodies and SMTPUTF8 when any header block at any depth is 8-bit. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2.7 KiB
FAIL
-
crates/ely-mail-engine/src/mime/walk.rs:35 — [P1] The round 2 nesting fix still permits a process-aborting stack overflow through embedded messages.
sub_parts()visits only multipart children, so 128 nestedmessage/rfc822entities returnOkdespite the claimed 64-level limit. With 8,192 such entities (262,188 bytes),readterminates the Windows process with0xc00000fd. The parser itself completes; dropping its recursively nestedPartType::Messageresult overflows the stack. Count embedded-message nesting as well as multipart nesting, and ensure over-limit parser results can be rejected and disposed of without recursive stack exhaustion. Add an embedded-message regression; the current depth test covers only multipart containers. Reproduced in.work/C12.2-r3/depth-128.log,depth-8192.log,depth-parse-forget.log, anddepth-parse-drop.log. -
crates/ely-mail-engine/src/mime/walk.rs:65 — [P2] Non-related multipart CID targets still disappear. In a
multipart/mixedcontaining an HTML reference tocid:compound@example.comand an inlinemultipart/alternativesibling with that Content-ID andfilename=compound.mime,readreturns emptyinlineandattachmentslists; only the sibling's descendant text survives. The multipart branch descends without retaining the containing entity, so its ID, filename and original bytes are unavailable. This leaves round 2's CID fix incomplete for composite parts and contradicts C12.2's non-attachment CID handling. Retain the composite entity as a CID target before traversing its contents, respecting the related-root exception, and test this structure. RFC 2392 §2 permits CID references to MIME entities. Reproduced in.work/C12.2-r3/cid.log. -
crates/ely-mail-engine/src/smtp.rs:104 — [P2] The new unencoded composite-forwarding path can send internationalized headers without SMTPUTF8. Build a draft with ASCII envelope and outer headers and a
message/globalattachment containingSubject: 您好. The attachment is emitted as 8bit, butsendinspects only the outer header block for SMTPUTF8: against a TLS test server advertising 8BITMIME without SMTPUTF8, it sends the complete message with onlyBODY=8BITMIMEand returnsOk(()). Such headers require SMTPUTF8 at any MIME depth (RFC 6531 §3.2 and §3.4); 8BITMIME alone does not authorize them. Carry or determine the complete MIME message's SMTPUTF8 requirement before sending, reject unsupported servers, and include the parameter when supported. Add a built-message/SMTP regression covering embedded UTF-8 headers. Reproduced in.work/C12.2-r3/embedded-header.log.