1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-30 08:26:59 +02:00
joplin/patches/sax+1.2.4.patch

19 lines
796 B
Diff

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: