diff --git a/lib/rules_block/list.js b/lib/rules_block/list.js index 2d6874e..49b9a5b 100644 --- a/lib/rules_block/list.js +++ b/lib/rules_block/list.js @@ -31,7 +31,8 @@ function skipBulletListMarker(state, startLine) { // or -1 on fail. function skipOrderedListMarker(state, startLine) { var ch, - pos = state.bMarks[startLine] + state.tShift[startLine], + start = state.bMarks[startLine] + state.tShift[startLine], + pos = start, max = state.eMarks[startLine]; // List marker should have at least 2 chars (digit + dot) @@ -48,6 +49,11 @@ function skipOrderedListMarker(state, startLine) { ch = state.src.charCodeAt(pos++); if (ch >= 0x30/* 0 */ && ch <= 0x39/* 9 */) { + + // List marker should have no more than 9 digits + // (prevents integer overflow in browsers) + if (pos - start >= 10) { return -1; } + continue; } diff --git a/test/fixtures/markdown-it/commonmark_extras.txt b/test/fixtures/markdown-it/commonmark_extras.txt index b951dfe..fe302ae 100644 --- a/test/fixtures/markdown-it/commonmark_extras.txt +++ b/test/fixtures/markdown-it/commonmark_extras.txt @@ -108,19 +108,6 @@ test . -List starting with zero: -. -0. foo -1. bar -2. baz -. -