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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insta crash on Hermes but works with JSC #56

Open
alexandrius opened this issue Jan 23, 2023 · 6 comments
Open

Insta crash on Hermes but works with JSC #56

alexandrius opened this issue Jan 23, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@alexandrius
Copy link
Collaborator

alexandrius commented Jan 23, 2023

Hey friends 馃憢,

I recently enabled this library in a project. Everything seemingly went through until I enabled Hermes engine. The app crashes immediately after launching with error:

error: Execution was interrupted, reason: EXC_BAD_ACCESS (code=1, address=0x0).
The process has been returned to the state before expression evaluation.

I found out that the issue happens in either of these methods BN_bn2lebinpad, BN_bn2binpad:

if (le)
{
BN_bn2lebinpad(thiz->bign, ab.data(runtime), len);
}
else
{
BN_bn2binpad(thiz->bign, ab.data(runtime), len);
}

Here's value of ab:
Screenshot 2023-01-24 at 12 05 06 PM

What I tried so far:

  • I commented out toArrayLike (inside commonjs/BigNumber.js) below here but weirdly the issue is still there. I wasn't able to find any toArrayLike invocations anywhere else

native.toArrayLike.call(
this.internalBigNum,
res.buffer,
endian === 'le',
len || -1
);

  • If I wrap if(ab.data(runtime) != NULL) the issue goes away but application doesn't behave correctly.

I would appreciate any suggestions.
Thanks!

@mrousavy
Copy link
Member

oh weird, maybe we use ArrayBuffer wrong, Hermes should have native support for that.... cc @Szymon20000

@kewde
Copy link

kewde commented Jan 26, 2023

Hermes doesn't allocate any memory for an ArraysBuffer's dataBuffer if the size is 0. It's a nullpointer.. The code also doesn't check if the ArrayBuffer size is sufficiently large to carry the BigNumber's data and potentially overflows.

@JuanRdBO
Copy link

JuanRdBO commented Jul 26, 2023

Any news on this? I would be excited to implement this library into my app. But this exact same issue is causing my app to insta-crash as well.

@Montchy Montchy added the bug Something isn't working label Aug 14, 2023
@mordonez-me
Copy link

Hello guys, do you guys have plans for fixing this bug? I am having an insta-crash like this:
image

@JuanRdBO
Copy link

JuanRdBO commented Apr 21, 2024

I'm having the same crash as above as well with @solana/web3.js

@alexandrius
Copy link
Collaborator Author

To everyone struggling with this issue. I recommend migrating to BigInt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants