Reviewers: Rico,

Description:
Do not try to execute empty programs.

After failing to read a non-existing file, the shell tried to execute the
resulting empty program, which resulted in a null pointer dereference. This
patch avoids execution of empty programs.


Please review this at http://codereview.chromium.org/6777005/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M samples/shell.cc


Index: samples/shell.cc
diff --git a/samples/shell.cc b/samples/shell.cc
index 0710d4643aa3a4845714f6e0259a9198ff5e81f0..ae6d015e157dc083aa017b3b73f762404af131f2 100644
--- a/samples/shell.cc
+++ b/samples/shell.cc
@@ -112,6 +112,7 @@ class SourceGroup {
         v8::Handle<v8::String> source = ReadFile(arg);
         if (source.IsEmpty()) {
           printf("Error reading '%s'\n", arg);
+          continue;
         }
         if (!ExecuteString(source, file_name, false, true)) {
           ExitShell(1);


--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev

Reply via email to