Skip to content
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

Max callstack exceeded in parser #4

Open
mvayngrib opened this issue Mar 11, 2017 · 2 comments
Open

Max callstack exceeded in parser #4

mvayngrib opened this issue Mar 11, 2017 · 2 comments

Comments

@mvayngrib
Copy link

trying to parse CSCA master lists (country signing certificates) from https://pkddownloadsg.icao.int/ (need to go through captcha at the bottom to get to the download)

const ldif = require('ldif')
const file = ldif.parseFile('./CSCA Master Lists.ldif')
      if (peg$c112.test(input.charAt(peg$currPos))) {
                   ^

RangeError: Maximum call stack size exceeded
    at RegExp.exec (native)
    at RegExp.test (native)
    at peg$parseBASE64_CHAR (/Users/tenaciousmv/Code/verifypassport/node_modules/ldif/lib/parser.js:2463:20)
    at peg$parseBASE64_STRING (/Users/tenaciousmv/Code/verifypassport/node_modules/ldif/lib/parser.js:2439:12)
    at peg$parsebase64_value_spec (/Users/tenaciousmv/Code/verifypassport/node_modules/ldif/lib/parser.js:2146:12)
    at peg$parsebase64_value_spec (/Users/tenaciousmv/Code/verifypassport/node_modules/ldif/lib/parser.js:2152:18)
    at peg$parsebase64_value_spec (/Users/tenaciousmv/Code/verifypassport/node_modules/ldif/lib/parser.js:2152:18)
    at peg$parsebase64_value_spec (/Users/tenaciousmv/Code/verifypassport/node_modules/ldif/lib/parser.js:2152:18)
    at peg$parsebase64_value_spec (/Users/tenaciousmv/Code/verifypassport/node_modules/ldif/lib/parser.js:2152:18)
    at peg$parsebase64_value_spec (/Users/tenaciousmv/Code/verifypassport/node_modules/ldif/lib/parser.js:2152:18)
@mvayngrib
Copy link
Author

@tapmodo your ldif-stream package parses it though :) I probably prefer a stream interface anyway

@tapmodo
Copy link
Owner

tapmodo commented Jul 7, 2017

this might be a difficult problem to solve. i am not an expert on the PEG parser generator, but i imagine a very large file could create a lot of recursion, when trying to parse the entire file at once. the maximum stack size can be increased, but clearly it's an inefficient approach. glad to hear the ldif-stream package solved the problem. for a lot of data i also would prefer a stream interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants