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

Maximum call stack size exceeded if parsing a lot of bit fields #233

Open
jonathanfady opened this issue Feb 7, 2023 · 0 comments
Open

Comments

@jonathanfady
Copy link

Hi !
I am trying out your package to parse a not so large binary data chunk into a lot of booleans (1200), some integers (50) and some strings (20), and I am getting a Maximum call stack size exceeded when running parse().
My booleans are 1-bit long (bit1) and the rest of the data is split among unit8, int8, uint16, int16, uint32, int32, float and string.
If I change the booleans to be parsed as uint8 or something else, the code will run.
The whole parsing code is running in a Web Worker but I don't think that changes anything.

The error is generated from the following line, so I guess the TODO makes sense !

private generateBit(ctx: Context) {
    // TODO find better method to handle nested bit fields
    const parser = JSON.parse(JSON.stringify(this));
    parser.options = this.options;

Could you look into this if you ever have the time ?
I would love to use your parser to avoid writting the entire parsing code by hand :)
If you have any other parser to suggest that manages a lot of bitfields that would also help.
Thanks for your great work !

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

1 participant