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

EXC_BAD_ADDRESS supposedly on large strings #145

Closed
dsemenovsky opened this issue Dec 19, 2019 · 4 comments
Closed

EXC_BAD_ADDRESS supposedly on large strings #145

dsemenovsky opened this issue Dec 19, 2019 · 4 comments
Labels
0.7.0 ios Affects iOS
Projects

Comments

@dsemenovsky
Copy link
Contributor

I get this error when processing large data.
The same code works perfectly on Android.

Screen Shot 2019-12-18 at 9 17 40 PM

@ericwlange
Copy link
Member

@dsemenovsky Thanks for reporting. The issue is that I am allocating the temporary new string on the stack, and for large strings it blows the stack. The solution is to allocate on the heap instead.

For a quick fix, replace:

    char temp[length + 1];

with

    char *temp = (char*) malloc(length + 1);

and then after JSStringRelease(s), put the following line:

    free(temp);

@ericwlange ericwlange self-assigned this Dec 26, 2019
@ericwlange ericwlange added 0.7.0 ios Affects iOS labels Dec 26, 2019
@ericwlange ericwlange added this to To do in 0.7.0 Dec 26, 2019
@dsemenovsky
Copy link
Contributor Author

@ericwlange Is the best way of doing it to fork the repo and install using Carthage from a fork after making these changes?

@ericwlange ericwlange moved this from To do to In progress in 0.7.0 Jan 4, 2020
@ericwlange ericwlange moved this from In progress to Done in 0.7.0 Jan 4, 2020
@ericwlange
Copy link
Member

accidental closure

@ericwlange ericwlange reopened this Jan 7, 2020
@ericwlange ericwlange removed their assignment Jan 17, 2020
@ericwlange
Copy link
Member

This is fixed in 0.7.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.7.0 ios Affects iOS
Projects
0.7.0
  
Done
Development

No branches or pull requests

2 participants