diff options
author | Jason Carey <jcarey@argv.me> | 2015-11-30 10:12:29 -0500 |
---|---|---|
committer | Jason Carey <jcarey@argv.me> | 2015-11-30 10:48:06 -0500 |
commit | f9450a619c2df8a2cb5925393095d6044a110afc (patch) | |
tree | c2df343a3c99c39ea6fe2783198404bde7edbf25 /src/mongo/scripting | |
parent | 16b5070833b20c73f87fc37df1f6a21afca825ba (diff) | |
download | mongo-f9450a619c2df8a2cb5925393095d6044a110afc.tar.gz |
SERVER-21692 check return of JS_NewRuntime
Moved an uassert away from a call site. Opens up the chance for nullptr
dereferences.
Diffstat (limited to 'src/mongo/scripting')
-rw-r--r-- | src/mongo/scripting/mozjs/implscope.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/mongo/scripting/mozjs/implscope.cpp b/src/mongo/scripting/mozjs/implscope.cpp index 5d099a6b254..4a90bdc76d7 100644 --- a/src/mongo/scripting/mozjs/implscope.cpp +++ b/src/mongo/scripting/mozjs/implscope.cpp @@ -230,6 +230,7 @@ MozJSImplScope::MozRuntime::MozRuntime(const MozJSScriptEngine* engine) { } _runtime = JS_NewRuntime(kMaxBytesBeforeGC); + uassert(ErrorCodes::JSInterpreterFailure, "Failed to initialize JSRuntime", _runtime); // We turn on a variety of optimizations if the jit is enabled if (engine->isJITEnabled()) { @@ -259,8 +260,6 @@ MozJSImplScope::MozRuntime::MozRuntime(const MozJSScriptEngine* engine) { } } - uassert(ErrorCodes::JSInterpreterFailure, "Failed to initialize JSRuntime", _runtime); - _context = JS_NewContext(_runtime, kStackChunkSize); uassert(ErrorCodes::JSInterpreterFailure, "Failed to initialize JSContext", _context); } |