LiquidPlayer / LiquidCore

Node.js virtual machine for Android and iOS
MIT License
1.01k stars 127 forks source link

EXC_BAD_ADDRESS supposedly on large strings #145

Closed dsemenovsky closed 4 years ago

dsemenovsky commented 4 years ago

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 commented 4 years ago

@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);
dsemenovsky commented 4 years ago

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

ericwlange commented 4 years ago

accidental closure

ericwlange commented 4 years ago

This is fixed in 0.7.x