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

React-Native crashed when try access err.stack #131

Open
ieow opened this issue Feb 2, 2024 · 2 comments
Open

React-Native crashed when try access err.stack #131

ieow opened this issue Feb 2, 2024 · 2 comments

Comments

@ieow
Copy link

ieow commented Feb 2, 2024

React Native app crashed when try to access stack field in the error object

in reactNative ( version 0.72.0 )

to reproduce (in react native)

    import {rpcErrors} from '@metamask/rpc-errors';
    
    try {
      let err = rpcErrors.invalidRequest();
      console.log(err.stack);
    } catch (error) {
      console.log(error);
    }

Accessing stack in Error class works fine

   try {
     let err = new Error("error message");
     console.log(err.stack);
   } catch (error) {
     console.log(error);
   }
@LeeNorth
Copy link

+1

@legobeat
Copy link
Contributor

legobeat commented Jul 23, 2024

Assigning a potentially cyclic object directly to serialized.stack is not safe.

Suggestion: Perform explicit serialization of the stack with a max-depth of recursion, or prune the reference.

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

3 participants