Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Mar 2, 2023. It is now read-only.
This repository was archived by the owner on Mar 2, 2023. It is now read-only.

Large Message Crash #7

@tpreusse

Description

@tpreusse

If a message is bigger than the V8 string length limit (Math.pow(2, 28), ~260mb) the parser will crash with following error:

node_modules/node-mbox/src/mbox.js:100
        stream.emit('message', 'From ' + chunks.join(''));
                                                ^

RangeError: Invalid string length
    at Array.join (native)
    at SBMH.<anonymous> (node_modules/node-mbox/src/mbox.js:100:49)
    at emitMany (events.js:146:13)
    at SBMH.emit (events.js:223:7)
    at SBMH._sbmh_feed (node_modules/streamsearch/lib/sbmh.js:159:14)
    at SBMH.push (node_modules/streamsearch/lib/sbmh.js:56:14)
    at MboxStream._transform (node_modules/node-mbox/src/mbox.js:119:17)
    at MboxStream.Transform._read (_stream_transform.js:186:10)
    at MboxStream.Transform._write (_stream_transform.js:174:12)
    at doWrite (_stream_writable.js:387:12)

A potential mitigation strategy:
https://gist.github.com/tpreusse/bc2ccf6fc6bf4ff563cdd336c1728db2/revisions#diff-05028f8355c8d7379cb42b5feac6429f
(throw error by default, skip or emit partial via options)

However the ultimate solution would be create a new api which allows to stream junks (e.g. to mailparser) as they come in. mailparser can probably handle almost unlimited attachment sizes with its attachment streams.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions