microsoft / microsoft/react-native-windows

AV in JsiAbiRuntime::RethrowJsiError() when using V8

Open
#7,939 1 comment 3 reactions 1 assignee View on GitHub

@vmoroz is already working on this.

Since Jun 3, 2021.

bug Partner: Microsoft Workstream: Developer Experience
Dominant language
C++
Stars
17.3k
Forks
1.2k
Avg merge
1d 13h
Merged PRs (30d)
33

Description

createWeakObject enters the catch block and calls RethrowJsiError(). However, GetAndClearError() returns null. Either GetAndClearError shouldn't be able to return null or RethrowJsiError() needs to handle null scenario.

WeakObject JsiAbiRuntime::createWeakObject(const Object &obj) try {
  return MakeWeakObject(m_runtime.CreateWeakObject(AsJsiObjectRef(obj)));
} catch (hresult_error const &) {
  RethrowJsiError();
  throw;
}

void JsiAbiRuntime::RethrowJsiError() const {
  auto jsiError = m_runtime.GetAndClearError();
  if (jsiError.ErrorType() == JsiErrorType::JSError) {
    throw AbiJSError{*const_cast<JsiAbiRuntime *>(this), std::move(jsiError)};
  } else {
    throw AbiJSINativeException{std::move(jsiError)};
  }
}

Environment

  1. npx react-native --version: 5.0.1-alpha.1
  2. npx react-native info:
    System:
    OS: Windows 10 10.0.21996
    CPU: (8) x64 Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
    Memory: 16.52 GB / 31.92 GB
    Binaries:
    Node: 16.2.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 7.13.0 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
    SDKs:
    Android SDK: Not Found
    Windows SDK:
    AllowDevelopmentWithoutDevLicense: Enabled
    AllowAllTrustedApps: Enabled
    Versions: 10.0.16299.0, 10.0.17763.0, 10.0.18362.0, 10.0.19041.0
    IDEs:
    Android Studio: Not Found
    Visual Studio: 16.9.31313.79 (Visual Studio Enterprise 2019)
    Languages:
    Java: Not Found
    npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.1 => 17.0.1
    react-native: 0.64.0-rc.3 => 0.64.0-rc.3
    react-native-windows: 0.64.0-preview.14 => 0.64.0-preview.14
    npmGlobalPackages:
    react-native: Not Found

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.