Revision: 13121
Author:   [email protected]
Date:     Mon Dec  3 09:57:17 2012
Log:      Fix null dereference after OOM.

[email protected]
BUG=

Review URL: https://chromiumcodereview.appspot.com/11414295
http://code.google.com/p/v8/source/detail?r=13121

Modified:
 /branches/bleeding_edge/src/debug.cc
 /branches/bleeding_edge/test/cctest/test-debug.cc

=======================================
--- /branches/bleeding_edge/src/debug.cc        Thu Nov  8 04:18:11 2012
+++ /branches/bleeding_edge/src/debug.cc        Mon Dec  3 09:57:17 2012
@@ -786,9 +786,11 @@
         "error_loading_debugger", &computed_location,
Vector<Handle<Object> >::empty(), Handle<String>(), Handle<JSArray>());
     ASSERT(!isolate->has_pending_exception());
-    isolate->set_pending_exception(*exception);
-    MessageHandler::ReportMessage(Isolate::Current(), NULL, message);
-    isolate->clear_pending_exception();
+    if (!exception.is_null()) {
+      isolate->set_pending_exception(*exception);
+      MessageHandler::ReportMessage(Isolate::Current(), NULL, message);
+      isolate->clear_pending_exception();
+    }
     return false;
   }

=======================================
--- /branches/bleeding_edge/test/cctest/test-debug.cc Wed Nov 21 23:58:59 2012 +++ /branches/bleeding_edge/test/cctest/test-debug.cc Mon Dec 3 09:57:17 2012
@@ -7532,4 +7532,18 @@
 }


+TEST(DebugContextOOM) {
+  v8::HandleScope scope;
+  LocalContext context;
+  v8::V8::IgnoreOutOfMemoryException();
+
+ v8::Local<v8::Value> result = CompileRun("a = '1'; while (true) a += a;");
+
+  // Check for out of memory state.
+  CHECK(result.IsEmpty());
+  CHECK(context->HasOutOfMemoryException());
+
+  v8::Debug::GetDebugContext();
+}
+
 #endif  // ENABLE_DEBUGGER_SUPPORT

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to