Skip to content

Commit 6b4b17f

Browse files
committed
[MERGE #5897 @rajatd] Wrap NewScObjectNoCtor with safe reentrancy macros when called from reentracy safe path. OS#19873760
Merge pull request #5897 from rajatd:reentrancy-check-fix
2 parents 32e04be + 414cd81 commit 6b4b17f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/Runtime/Library/JavascriptFunction.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,11 @@ using namespace Js;
866866
}
867867
else
868868
{
869-
resultObject = JavascriptOperators::NewScObjectNoCtor(v, scriptContext);
869+
BEGIN_SAFE_REENTRANT_CALL(scriptContext->GetThreadContext())
870+
{
871+
resultObject = JavascriptOperators::NewScObjectNoCtor(v, scriptContext);
872+
}
873+
END_SAFE_REENTRANT_CALL
870874
}
871875

872876
// JavascriptOperators::NewScObjectNoCtor should have thrown if 'v' is not a constructor

lib/Runtime/Library/JavascriptProxy.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2143,7 +2143,11 @@ namespace Js
21432143
// args.Values[0] will be null in the case where NewTarget is initially provided by proxy.
21442144
if (!isCtorSuperCall || !args.Values[0])
21452145
{
2146-
newThisObject = JavascriptOperators::NewScObjectNoCtor(targetObj, scriptContext);
2146+
BEGIN_SAFE_REENTRANT_CALL(scriptContext->GetThreadContext())
2147+
{
2148+
newThisObject = JavascriptOperators::NewScObjectNoCtor(targetObj, scriptContext);
2149+
}
2150+
END_SAFE_REENTRANT_CALL
21472151
args.Values[0] = newThisObject;
21482152
}
21492153
else

0 commit comments

Comments
 (0)