Revision: 23023
Author:   [email protected]
Date:     Mon Aug 11 07:59:10 2014 UTC
Log:      Make %DebugPushPromise more robust wrt fuzzing.

If %DebugPushPromise and throwing is called outside its intended context,
we may encounter assertion failures.

[email protected]
BUG=401915
LOG=N

Review URL: https://codereview.chromium.org/453933002
http://code.google.com/p/v8/source/detail?r=23023

Added:
 /branches/bleeding_edge/test/mjsunit/regress/regress-crbug-401915.js
Modified:
 /branches/bleeding_edge/src/debug.cc

=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/regress/regress-crbug-401915.js Mon Aug 11 07:59:10 2014 UTC
@@ -0,0 +1,20 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --expose-debug-as debug
+
+Debug = debug.Debug;
+Debug.setListener(function() {});
+Debug.setBreakOnException();
+
+try {
+  try {
+    %DebugPushPromise(new Promise(function() {}));
+  } catch (e) {
+  }
+  throw new Error();
+} catch (e) {
+}
+
+Debug.setListener(null);
=======================================
--- /branches/bleeding_edge/src/debug.cc        Wed Aug  6 13:56:58 2014 UTC
+++ /branches/bleeding_edge/src/debug.cc        Mon Aug 11 07:59:10 2014 UTC
@@ -1316,11 +1316,9 @@
       return thread_local_.promise_on_stack_->promise();
     }
     handler = handler->next();
-    // There must be a try-catch handler if a promise is on stack.
-    DCHECK_NE(NULL, handler);
// Throwing inside a Promise can be intercepted by an inner try-catch, so
     // we stop at the first try-catch handler.
-  } while (!handler->is_catch());
+  } while (handler != NULL && !handler->is_catch());
   return undefined;
 }

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to