Commit f736f0a6 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Prevent segfault when preparser fails due to lack of argument.

BUG=v8:1963
TEST=run preparser with no command line arguments

Review URL: https://chromiumcodereview.appspot.com/9431028

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10786 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent c3297c8d
...@@ -200,12 +200,14 @@ void fail(v8::PreParserData* data, const char* message, ...) { ...@@ -200,12 +200,14 @@ void fail(v8::PreParserData* data, const char* message, ...) {
vfprintf(stderr, message, args); vfprintf(stderr, message, args);
va_end(args); va_end(args);
fflush(stderr); fflush(stderr);
// Print preparser data to stdout. if (data != NULL) {
uint32_t size = data->size(); // Print preparser data to stdout.
fprintf(stderr, "LOG: data size: %u\n", size); uint32_t size = data->size();
if (!WriteBuffer(stdout, data->data(), size)) { fprintf(stderr, "LOG: data size: %u\n", size);
perror("ERROR: Writing data"); if (!WriteBuffer(stdout, data->data(), size)) {
fflush(stderr); perror("ERROR: Writing data");
fflush(stderr);
}
} }
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment