Open alexandrius opened 1 year ago
oh weird, maybe we use ArrayBuffer wrong, Hermes should have native support for that.... cc @Szymon20000
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.
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.
Hello guys, do you guys have plans for fixing this bug? I am having an insta-crash like this:
I'm having the same crash as above as well with @solana/web3.js
To everyone struggling with this issue. I recommend migrating to BigInt
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:
I found out that the issue happens in either of these methods
BN_bn2lebinpad
,BN_bn2binpad
: https://github.com/margelo/react-native-bignumber/blob/56873d9930f47379233edd183eec4454c6d97db3/cpp/MGBigNumberHostObject.cpp#L138-L145Here's value of![Screenshot 2023-01-24 at 12 05 06 PM](https://user-images.githubusercontent.com/5978212/214240546-8ce58fa1-e1cb-4e5d-8e32-e93c9a1f3372.png)
ab
:What I tried so far:
toArrayLike
(insidecommonjs/BigNumber.js
) below here but weirdly the issue is still there. I wasn't able to find any toArrayLike invocations anywhere elsehttps://github.com/margelo/react-native-bignumber/blob/56873d9930f47379233edd183eec4454c6d97db3/src/BigNumber.ts#L247-L252
if(ab.data(runtime) != NULL)
the issue goes away but application doesn't behave correctly.I would appreciate any suggestions. Thanks!