Revision: 19764
Author:   [email protected]
Date:     Mon Mar 10 15:52:10 2014 UTC
Log:      Fix assertion in RegExp parser to correctly expect stack overflow.

Advance() always checks for stack overflow. If stack indeed overflowed,
current() would hold the kEndMarker. ParseOctalLiteral does not expect
this in the assertion, which causes assertion failure.

[email protected]
BUG=350865
LOG=N

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

Added:
 /branches/bleeding_edge/test/mjsunit/regress/regress-350865.js
Modified:
 /branches/bleeding_edge/src/parser.cc

=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/regress/regress-350865.js Mon Mar 10 15:52:10 2014 UTC
@@ -0,0 +1,17 @@
+// 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: --stress-compaction --stack-size=150
+
+/\2/.test("1");
+
+function rec() {
+  try {
+    rec();
+  } catch(e) {
+    /\2/.test("1");
+  }
+}
+
+rec();
=======================================
--- /branches/bleeding_edge/src/parser.cc       Mon Mar 10 15:19:20 2014 UTC
+++ /branches/bleeding_edge/src/parser.cc       Mon Mar 10 15:52:10 2014 UTC
@@ -4990,7 +4990,7 @@


 uc32 RegExpParser::ParseOctalLiteral() {
-  ASSERT('0' <= current() && current() <= '7');
+ ASSERT(('0' <= current() && current() <= '7') || current() == kEndMarker);
   // For compatibility with some other browsers (not all), we parse
   // up to three octal digits with a value below 256.
   uc32 value = current() - '0';

--
--
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