-
Notifications
You must be signed in to change notification settings - Fork 620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON DOS #2107
Comments
A related issue: #1682 |
masatake
added a commit
to masatake/ctags
that referenced
this issue
Jun 11, 2019
Close universal-ctags#2107. Related to universal-ctags#1682. To avoid stack overflow, this change provides the way to terminate the parsing. The recursion is very related to square brackets and curly brackets. Instead of limit the function recursion, this change tracks the depth of brackets. Here I assume deep brackets in input stream causes deep function call recursion. readTokenFull is changed to return EOF when it detects too deep (> 512) brackets in the current input stream. The EOF terminates the parsing. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
masatake
added a commit
to masatake/ctags
that referenced
this issue
Jun 12, 2019
…airs Close universal-ctags#2107. Related to universal-ctags#1682. To avoid stack overflow, this change provides the way to terminate the parsing if recursion CAN be too deep. The recursion is very related to square brackets and curly brackets in input stream. Instead of limit the depth of function recursion itself, this change tracks the depth of brackets. Here I assume deeply nested brackets increases the recursion depth of function calls. readTokenFull is changed to return EOF token when it detects too deeply nested (>= 512) brackets in the current input stream. The EOF token may terminate the parsing GENTLY. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
masatake
added a commit
to masatake/ctags
that referenced
this issue
Jul 14, 2019
…airs Close universal-ctags#2107 reported by @hanwen. Related to universal-ctags#1682. To avoid stack overflow, this change provides the way to terminate the parsing if recursion CAN be too deep. The recursion is very related to square brackets and curly brackets in input stream. Instead of limit the depth of function recursion itself, this change tracks the depth of brackets. Here I assume deeply nested brackets increases the recursion depth of function calls. readTokenFull is changed to return EOF token when it detects too deeply nested (>= 512) brackets in the current input stream. The EOF token may terminate the parsing GENTLY. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(
The name of the parser:
json
The command line you used to run ctags:
The content of input file: https://github.com/sirthias/borer/blob/master/core/.jvm/src/test/resources/n_structure_100000_opening_arrays.json
(this is a sequence of 100k '[' chars)
The tags output you are not satisfied with:
heap increases to many Gb until it crashes with segfault.
It would be nice if this could either exit with an error, or use less memory and succeed.
The tags output you expect:
The version of ctags:
How do you get ctags binary:
local build, linux.
The text was updated successfully, but these errors were encountered: