From df3b7639ca119260e91c3757a8f4f1978cd9db39 Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Fri, 14 Nov 2008 14:36:32 -0800 Subject: [PATCH] Bug 464986 - Crash trying to compile a trace generated from stdin in debug build. r=danderson --- js/src/jstracer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/src/jstracer.cpp b/js/src/jstracer.cpp index 68c6530393c..9caaba52584 100644 --- a/js/src/jstracer.cpp +++ b/js/src/jstracer.cpp @@ -2185,8 +2185,9 @@ TraceRecorder::compile(Fragmento* fragmento) fragment->vmprivate = treeInfo; /* :TODO: windows support */ #if defined DEBUG && !defined WIN32 - char* label = (char*)malloc(strlen(cx->fp->script->filename) + 16); - sprintf(label, "%s:%u", cx->fp->script->filename, + const char* filename = cx->fp->script->filename; + char* label = (char*)malloc((filename ? strlen(filename) : 7) + 16); + sprintf(label, "%s:%u", filename ? filename : "", js_FramePCToLineNumber(cx, cx->fp)); fragmento->labels->add(fragment, sizeof(Fragment), 0, label); free(label);