diff --git a/node_modules/sax/lib/sax.js b/node_modules/sax/lib/sax.js index 795d607..ccad5d8 100644 --- a/node_modules/sax/lib/sax.js +++ b/node_modules/sax/lib/sax.js @@ -1040,6 +1040,13 @@ parser.textNode += c } } + + // Sax is kind of buggy when handling large text node. It has a function to check that + // the buffer doesn't run out of space but it doesn't seem to call it for text node. + // The result is that parser.textNode reaches 1GB and then the app crashes. So here + // we call checkBufferLength to make sure the buffer is cleared and the "text" event + // emitted so that the caller can handle memory properly. + checkBufferLength(parser); continue case S.SCRIPT: