Bug 1219954 - Check for OOM in js::AsmJSFunctionToString() r=bbouvier
authorJon Coppeard <jcoppeard@mozilla.com>
Tue, 03 Nov 2015 13:47:23 +0000
changeset 270933 d3cab4bc33b015cf2544349d22e7899d401075e2
parent 270932 5bd197b129a8b3daae102e6151b8f6fea60d8824
child 270934 72a8903bd4bf7b847753b97b18257c032203443a
push id67506
push userjcoppeard@mozilla.com
push dateTue, 03 Nov 2015 13:51:51 +0000
treeherdermozilla-inbound@72a8903bd4bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1219954
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1219954 - Check for OOM in js::AsmJSFunctionToString() r=bbouvier
js/src/asmjs/AsmJSLink.cpp
js/src/jit-test/tests/asm.js/bug1219954.js
--- a/js/src/asmjs/AsmJSLink.cpp
+++ b/js/src/asmjs/AsmJSLink.cpp
@@ -1292,17 +1292,17 @@ js::AsmJSFunctionToString(JSContext* cx,
 
             // asm.js functions can't be anonymous
             MOZ_ASSERT(fun->atom());
             if (!out.append(fun->atom()))
                 return nullptr;
 
             size_t nameEnd = begin + fun->atom()->length();
             Rooted<JSFlatString*> src(cx, source->substring(cx, nameEnd, end));
-            if (!AppendUseStrictSource(cx, fun, src, out))
+            if (!src || !AppendUseStrictSource(cx, fun, src, out))
                 return nullptr;
         } else {
             Rooted<JSFlatString*> src(cx, source->substring(cx, begin, end));
             if (!src)
                 return nullptr;
             if (!out.append(src))
                 return nullptr;
         }
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/asm.js/bug1219954.js
@@ -0,0 +1,12 @@
+"use strict";
+
+if (!('oomTest' in this))
+    quit();
+
+let g = (function() {
+    "use asm";
+    function f() {}
+    return f;
+})();
+
+oomTest(() => "" + g);