var fs = require('fs')
var micromark = require('micromark')
var gfmSyntax = require('micromark-extension-gfm')
var gfmHtml = require('micromark-extension-gfm/html')
var doc = fs.readFileSync('<one of the crash files goes here>')
var result = micromark(doc, {
allowDangerousHtml: true,
extensions: [gfmSyntax()],
htmlExtensions: [gfmHtml]
})
console.log(result)
Run any of the attached files through to reproduce the issue
RangeError: Maximum call stack size exceeded
at assign (<anonymous>)
at shallow (/micromark/dist/util/shallow.js:1:1131)
at now (/micromark/dist/util/create-tokenizer.js:1:21524)
at Object.enter (/micromark/dist/util/create-tokenizer.js:1:24223)
at cellBreakHead (/micromark/node_modules/micromark-extension-gfm-table/syntax.js:1:46598)
at inCellContentHead (/micromark/node_modules/micromark-extension-gfm-table/syntax.js:1:47495)
at cellBreakHead (/micromark/node_modules/micromark-extension-gfm-table/syntax.js:1:46663)
at inCellContentHead (/micromark/node_modules/micromark-extension-gfm-table/syntax.js:1:47495)
at cellBreakHead (/micromark/node_modules/micromark-extension-gfm-table/syntax.js:1:46663)
at inCellContentHead (/micromark/node_modules/micromark-extension-gfm-table/syntax.js:1:47495)
The characters 1, 2, 3, and 4 were mistakenly seen as being some form of whitespace due to a typo, but the whitespace state thought they were content (they are).
Subject of the issue
Some short inputs produce
RangeError: Maximum call stack size exceeded
errorsYour environment
Steps to reproduce
discovered using https://github.com/micromark/micromark/pull/18
Run any of the attached files through to reproduce the issue
crash-5ea430ec94fc2ad0111b7a93902717954c33aee70c4580157e2e33f1233b771f.txt crash-8d29501e5df33f9267a4c3e5756c3f064b02ac17b1a94dd9fed3864065cac8f7.txt crash-18fa9164e99eede7aef9a4b132dfd102c63af51f5281a5e65f62d7f8a05da2c2.txt crash-44ddd3dab072ad531b8d1d8bf1de45d1434239863e92eb11e24376a2250833bd.txt crash-61c581437cca1b8a729dbc7785c87c990a15e64246bc38177a47299817f410d6.txt crash-199c3bd460de84b1e70363da216e177a93d918f6e4ba3abb485f961ca8f5d20d.txt crash-0986c194573a3b25288270e3238197192b2c5e16780905f85e6b5d307de17030.txt crash-3647cb12a83367983354b6aa65573a230990070507444681e6d3c4c19c3d1f8d.txt crash-a00f61d5c6ccbd0fa0f439bd59fe31ebdaa62dd5fa18bc7a40b6a78df0362220.txt crash-c89af552ec529a6276432019ad8f404aa630dc590de696c1c164aa1baec4b3a0.txt crash-d5f7abcafb561be96fb5af1839cd54a47303216105afa9477d072d7fcdc5d6fd.txt
Expected behavior
micromark should not crash
Actual behavior