1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-27 10:32:58 +02:00
joplin/packages/fork-sax/test/buffer-overrun.js

31 lines
1.0 KiB
JavaScript
Raw Normal View History

2020-11-05 18:58:23 +02:00
// set this really low so that I don't have to put 64 MB of xml in here.
var sax = require('../lib/sax')
var bl = sax.MAX_BUFFER_LENGTH
sax.MAX_BUFFER_LENGTH = 5
require(__dirname).test({
expect: [
['error', 'Max buffer length exceeded: tagName\nLine: 0\nColumn: 15\nChar: '],
['error', 'Max buffer length exceeded: tagName\nLine: 0\nColumn: 30\nChar: '],
['error', 'Max buffer length exceeded: tagName\nLine: 0\nColumn: 45\nChar: '],
['opentagstart', {
'name': 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ',
'attributes': {}
}],
['opentag', {
'name': 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ',
'attributes': {},
'isSelfClosing': false
}],
['text', 'yo'],
['closetag', 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ']
]
}).write('<abcdefghijklmn')
.write('opqrstuvwxyzABC')
.write('DEFGHIJKLMNOPQR')
.write('STUVWXYZ>')
.write('yo')
.write('</abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ>')
.close()
sax.MAX_BUFFER_LENGTH = bl