Bug 1012646 - Check for non-existant script filenames in SavedStacks::insertFrames. r=ejpbruel
authorNick Fitzgerald <fitzgen@mozilla.com>
Tue, 20 May 2014 15:45:00 +0200
changeset 184068 b34ba09e0391f1cbff3b3255e09d898978214ec5
parent 184067 afe8ef1b62d138cf3c13833be8c0d7d4cd132d7e
child 184069 6e75378db0c76517c6c441b379c6160b771b4886
push id26810
push usercbook@mozilla.com
push dateWed, 21 May 2014 11:46:36 +0000
treeherdermozilla-central@50fb8c4db2fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersejpbruel
bugs1012646
milestone32.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 1012646 - Check for non-existant script filenames in SavedStacks::insertFrames. r=ejpbruel
js/src/jit-test/tests/saved-stacks/bug-1012646-strlen-crasher.js
js/src/vm/SavedStacks.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/saved-stacks/bug-1012646-strlen-crasher.js
@@ -0,0 +1,4 @@
+// |jit-test| exitstatus: 3
+
+enableTrackAllocations();
+evaluate("throw Error();", {fileName: null});
--- a/js/src/vm/SavedStacks.cpp
+++ b/js/src/vm/SavedStacks.cpp
@@ -437,16 +437,18 @@ SavedStacks::insertFrames(JSContext *cx,
     ScriptFrameIter thisFrame(iter);
     Rooted<SavedFrame*> parentFrame(cx);
     if (!insertFrames(cx, ++iter, &parentFrame))
         return false;
 
     RootedScript script(cx, thisFrame.script());
     RootedFunction callee(cx, thisFrame.maybeCallee());
     const char *filename = script->filename();
+    if (!filename)
+        filename = "";
     RootedAtom source(cx, Atomize(cx, filename, strlen(filename)));
     if (!source)
         return false;
     uint32_t column;
     uint32_t line = PCToLineNumber(script, thisFrame.pc(), &column);
 
     SavedFrame::Lookup lookup(source,
                               line,