Revision: 7473
Author:   [email protected]
Date:     Fri Apr  1 04:47:42 2011
Log:      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.

Review URL: http://codereview.chromium.org/6777005
http://code.google.com/p/v8/source/detail?r=7473

Modified:
 /branches/bleeding_edge/samples/shell.cc

=======================================
--- /branches/bleeding_edge/samples/shell.cc    Tue Mar 29 21:36:41 2011
+++ /branches/bleeding_edge/samples/shell.cc    Fri Apr  1 04:47:42 2011
@@ -1,4 +1,4 @@
-// Copyright 2009 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions are
 // met:
@@ -112,6 +112,7 @@
         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
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to