Skip to content

Commit 210c0b2

Browse files
CelluleSuwei Chen
authored and
Suwei Chen
committed
[CVE-2017-8755] Fail fast if we can't reparse asm.js module after linking failure
1 parent 599af18 commit 210c0b2

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

lib/Runtime/Library/JavascriptFunction.cpp

+16-10
Original file line numberDiff line numberDiff line change
@@ -1688,20 +1688,26 @@ void __cdecl _alloca_probe_16()
16881688
void JavascriptFunction::ReparseAsmJsModule(ScriptFunction** functionRef)
16891689
{
16901690
ParseableFunctionInfo* functionInfo = (*functionRef)->GetParseableFunctionInfo();
1691-
16921691
Assert(functionInfo);
1693-
functionInfo->GetFunctionBody()->AddDeferParseAttribute();
1694-
functionInfo->GetFunctionBody()->ResetEntryPoint();
1695-
functionInfo->GetFunctionBody()->ResetInParams();
1692+
try
1693+
{
1694+
functionInfo->GetFunctionBody()->AddDeferParseAttribute();
1695+
functionInfo->GetFunctionBody()->ResetEntryPoint();
1696+
functionInfo->GetFunctionBody()->ResetInParams();
16961697

1697-
FunctionBody * funcBody = functionInfo->Parse(functionRef);
1698+
FunctionBody * funcBody = functionInfo->Parse(functionRef);
16981699

1699-
#if ENABLE_PROFILE_INFO
1700-
// This is the first call to the function, ensure dynamic profile info
1701-
funcBody->EnsureDynamicProfileInfo();
1702-
#endif
1700+
#if ENABLE_PROFILE_INFO
1701+
// This is the first call to the function, ensure dynamic profile info
1702+
funcBody->EnsureDynamicProfileInfo();
1703+
#endif
17031704

1704-
(*functionRef)->UpdateUndeferredBody(funcBody);
1705+
(*functionRef)->UpdateUndeferredBody(funcBody);
1706+
}
1707+
catch (JavascriptException&)
1708+
{
1709+
Js::Throw::FatalInternalError();
1710+
}
17051711
}
17061712

17071713
// Thunk for handling calls to functions that have not had byte code generated for them.

0 commit comments

Comments
 (0)