Skip to content

[BUG] Infinite recursion in blocks text parser #752

Open
@sam0jones0

Description

@sam0jones0

Environment

GitHub v2-dev branch

Description

The blocks text parser is experiencing infinite recursion when processing certain code blocks. I think the regex patterns are causing catastrophic backtracking in the code block parsing logic.

Note this first started appearing after I imported a PDF and asked Google Flash 2.0 to extract the text.

Steps to reproduce:

Device and browser

Firefox 135.0 (64-bit). Windows 10

Screenshots and more

InternalError: too much recursion

parseBlocksFromText@http://localhost:3000/_next/static/chunks/src_modules_blocks_47ff4c._.js:4087:44
useAutoBlocksMemoSemiStable.useMemo@http://localhost:3000/_next/static/chunks/src_modules_blocks_47ff4c._.js:4233:197
mountMemo@http://localhost:3000/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e07.js:14033:29
useMemo@http://localhost:3000/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e07.js:14417:32
useMemo@http://localhost:3000/_next/static/chunks/node_modules_react_1cad9b._.js:1356:31
useAutoBlocksMemoSemiStable@http://localhost:3000/_next/static/chunks/src_modules_blocks_47ff4c._.js:4208:135
AutoBlocksRenderer@http://localhost:3000/_next/static/chunks/src_modules_blocks_47ff4c._.js:4416:201
renderWithHooks@http://localhost:3000/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e07.js:13260:37
mountIndeterminateComponent@http://localhost:3000/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e07.js:17136:25
beginWork@http://localhost:3000/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e07.js:18376:32
callCallback@http://localhost:3000/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e07.js:3802:30
invokeGuardedCallbackDev@http://localhost:3000/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e07.js:3840:30
invokeGuardedCallback@http://localhost:3000/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e07.js:3893:41
beginWork$1@http://localhost:3000/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e07.js:23119:42
performUnitOfWork@http://localhost:3000/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e07.js:22402:24
workLoopSync@http://localhost:3000/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e07.js:22331:34
renderRootSync@http://localhost:3000/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e07.js:22308:21
performConcurrentWorkOnRoot@http://localhost:3000/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e07.js:21732:84
workLoop@http://localhost:3000/_next/static/chunks/node_modules_4877a7._.js:267:56
flushWork@http://localhost:3000/_next/static/chunks/node_modules_4877a7._.js:246:28
performWorkUntilDeadline@http://localhost:3000/_next/static/chunks/node_modules_4877a7._.js:474:35
EventHandlerNonNull*[project]/node_modules/scheduler/cjs/scheduler.development.js [client] (ecmascript)/<@http://localhost:3000/_next/static/chunks/node_modules_4877a7._.js:510:13
[project]/node_modules/scheduler/cjs/scheduler.development.js [client] (ecmascript)@http://localhost:3000/_next/static/chunks/node_modules_4877a7._.js:559:7
instantiateModule/<@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:693:27
runModuleExecutionHooks@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:738:22
instantiateModule@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:691:32
getOrInstantiateModuleFromParent@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:624:12
commonJsRequire@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:157:52
[project]/node_modules/scheduler/index.js [client] (ecmascript)@http://localhost:3000/_next/static/chunks/node_modules_4877a7._.js:571:22
instantiateModule/<@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:693:27
runModuleExecutionHooks@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:738:22
instantiateModule@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:691:32
getOrInstantiateModuleFromParent@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:624:12
commonJsRequire@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:157:52
[project]/node_modules/react-dom/cjs/react-dom.development.js [client] (ecmascript)/<@http://localhost:3000/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e07.js:24:46
[project]/node_modules/react-dom/cjs/react-dom.development.js [client] (ecmascript)@http://localhost:3000/_next/static/chunks/node_modules_react-dom_cjs_react-dom_development_ab7e07.js:25080:7
instantiateModule/<@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:693:27
runModuleExecutionHooks@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:738:22
instantiateModule@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:691:32
getOrInstantiateModuleFromParent@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:624:12
commonJsRequire@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:157:52
[project]/node_modules/react-dom/index.js [client] (ecmascript)@http://localhost:3000/_next/static/chunks/node_modules_react-dom_f14d04._.js:35:22
instantiateModule/<@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:693:27
runModuleExecutionHooks@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:738:22
instantiateModule@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:691:32
getOrInstantiateModuleFromParent@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:624:12
commonJsRequire@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:157:52
[project]/node_modules/react-dom/client.js [client] (ecmascript)@http://localhost:3000/_next/static/chunks/node_modules_react-dom_f14d04._.js:44:30
instantiateModule/<@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:693:27
runModuleExecutionHooks@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:738:22
instantiateModule@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:691:32
getOrInstantiateModuleFromParent@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:624:12
commonJsRequire@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:157:52
[project]/node_modules/next/dist/client/index.js [client] (ecmascript)@http://localhost:3000/_next/static/chunks/node_modules_next_e2f0a6._.js:18647:58
instantiateModule/<@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:693:27
runModuleExecutionHooks@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:738:22
instantiateModule@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:691:32
getOrInstantiateModuleFromParent@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:624:12
commonJsRequire@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:157:52
[project]/node_modules/next/dist/client/next-dev-turbopack.js [client] (ecmascript)@http://localhost:3000/_next/static/chunks/node_modules_next_e2f0a6._.js:20343:32
instantiateModule/<@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:693:27
runModuleExecutionHooks@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:738:22
instantiateModule@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:691:32
getOrInstantiateRuntimeModule@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:602:12
registerChunk@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:1439:50
async*registerChunk@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:560:20@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:1647:18@http://localhost:3000/_next/static/chunks/pages__app_6f7c11._.js:1648:3

Willingness to Contribute

  • 🙋‍♂️ Yes, I would like to contribute a fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions