Bug 1285934: Report an error in case of OOM when copying the bytecode input; r?luke
MozReview-Commit-ID: A6Jw1O3tu2c
--- a/js/src/asmjs/WasmJS.cpp
+++ b/js/src/asmjs/WasmJS.cpp
@@ -126,18 +126,20 @@ GetImports(JSContext* cx, HandleObject i
bool
wasm::Eval(JSContext* cx, Handle<TypedArrayObject*> code, HandleObject importObj,
MutableHandleWasmInstanceObject instanceObj)
{
if (!CheckCompilerSupport(cx))
return false;
Bytes bytecode;
- if (!bytecode.append((uint8_t*)code->viewDataEither().unwrap(), code->byteLength()))
+ if (!bytecode.append((uint8_t*)code->viewDataEither().unwrap(), code->byteLength())) {
+ ReportOutOfMemory(cx);
return false;
+ }
CompileArgs compileArgs;
if (!compileArgs.init(cx))
return true;
JS::AutoFilename af;
if (DescribeScriptedCaller(cx, &af)) {
compileArgs.filename = DuplicateString(cx, af.get());