You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vue-i18n crashes when a long text is to be displayed. The problem is that in message-compiler/src/tokenizer.ts a recursion is used in the function readText. If several thousand characters are displayed, for example 20000 in my case, there is a stack overflow because the function calls itself so often. It should be easy to rewrite this function iteratively.
Stacktrace: Uncaught RangeError: Maximum call stack size exceeded at charAt (message-compiler.esm-bundler.js?f92f:80) at Object.currentPeek (message-compiler.esm-bundler.js?f92f:82) at fn (message-compiler.esm-bundler.js?f92f:329) at isTextStart (message-compiler.esm-bundler.js?f92f:357) at fn (message-compiler.esm-bundler.js?f92f:431) at fn (message-compiler.esm-bundler.js?f92f:448) at fn (message-compiler.esm-bundler.js?f92f:448) at fn (message-compiler.esm-bundler.js?f92f:448) at fn (message-compiler.esm-bundler.js?f92f:448) at fn (message-compiler.esm-bundler.js?f92f:448)
Expected behavior
Text should be rendered and no exception should be thrown.
Reproduction
Insert a text with several thousand characters (e.g. 20000) into the language file and display it on the website.
* add #712 reproduction case
* remove unnecesary code
* Rewrite readText as an iterative version
Fix warning in test
Co-authored-by: kazuya kawaguchi <kawakazu80@gmail.com>
Reporting a bug?
Vue-i18n crashes when a long text is to be displayed. The problem is that in
message-compiler/src/tokenizer.ts
a recursion is used in the functionreadText
. If several thousand characters are displayed, for example 20000 in my case, there is a stack overflow because the function calls itself so often. It should be easy to rewrite this function iteratively.Stacktrace:
Uncaught RangeError: Maximum call stack size exceeded at charAt (message-compiler.esm-bundler.js?f92f:80) at Object.currentPeek (message-compiler.esm-bundler.js?f92f:82) at fn (message-compiler.esm-bundler.js?f92f:329) at isTextStart (message-compiler.esm-bundler.js?f92f:357) at fn (message-compiler.esm-bundler.js?f92f:431) at fn (message-compiler.esm-bundler.js?f92f:448) at fn (message-compiler.esm-bundler.js?f92f:448) at fn (message-compiler.esm-bundler.js?f92f:448) at fn (message-compiler.esm-bundler.js?f92f:448) at fn (message-compiler.esm-bundler.js?f92f:448)
Expected behavior
Text should be rendered and no exception should be thrown.
Reproduction
Insert a text with several thousand characters (e.g. 20000) into the language file and display it on the website.
System Info
Screenshot
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: