Skip to content

Commit

Permalink
Placate exception check validation in sanitizeRemoteFunctionException.
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=260750
rdar://114477714

Reviewed by Justin Michaud.

sanitizeRemoteFunctionException() can call JSValue::toWTFString() which may throw under certain
circumstances.  However, it is only called here if exceptionValue.isPrimitive() i.e. it will
never throw.  However, the exception check validator does not know this.  So, we added an
`ASSERT(!scope.exception())` to placate it.

However, if we're forcing exception check validation on a Release build, the ASSERT turns into a
no-op.  The fix is to use EXCEPTION_ASSERT here instead.

* Source/JavaScriptCore/interpreter/Interpreter.cpp:
(JSC::sanitizeRemoteFunctionException):

Canonical link: https://commits.webkit.org/267311@main
  • Loading branch information
Mark Lam committed Aug 26, 2023
1 parent fbae20a commit 9b124cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/interpreter/Interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ static void sanitizeRemoteFunctionException(VM& vm, JSRemoteFunction* remoteFunc
else if (exceptionValue.asCell()->inherits<ErrorInstance>())
exceptionString = static_cast<ErrorInstance*>(exceptionValue.asCell())->sanitizedMessageString(globalObject);

ASSERT(!scope.exception()); // We must not have entered JS at this point
EXCEPTION_ASSERT(!scope.exception()); // We must not have entered JS at this point

if (exceptionString.length()) {
throwVMTypeError(globalObject, scope, exceptionString);
Expand Down

0 comments on commit 9b124cc

Please sign in to comment.