diff --git a/src/diagnostics/objects-printer.cc b/src/diagnostics/objects-printer.cc index 54cc65aa7e..a67771ab6c 100644 --- a/src/diagnostics/objects-printer.cc +++ b/src/diagnostics/objects-printer.cc @@ -688,9 +688,11 @@ void JSPromise::JSPromisePrint(std::ostream& os) { } void JSRegExp::JSRegExpPrint(std::ostream& os) { + Isolate* isolate = GetIsolate(); JSObjectPrintHeader(os, *this, "JSRegExp"); os << "\n - data: " << Brief(data()); os << "\n - source: " << Brief(source()); + os << "\n - flags: " << Brief(*JSRegExp::StringFromFlags(isolate, flags())); JSObjectPrintBody(os, *this); } diff --git a/src/regexp/regexp-compiler.cc b/src/regexp/regexp-compiler.cc index f18d0451cd..711bd6249b 100644 --- a/src/regexp/regexp-compiler.cc +++ b/src/regexp/regexp-compiler.cc @@ -1669,12 +1669,14 @@ void TextNode::GetQuickCheckDetails(QuickCheckDetails* details, details->positions(characters_filled_in); RegExpCharacterClass* tree = elm.char_class(); ZoneList* ranges = tree->ranges(zone()); - DCHECK(!ranges->is_empty()); - if (tree->is_negated()) { + if (tree->is_negated() || ranges->is_empty()) { // A quick check uses multi-character mask and compare. There is no // useful way to incorporate a negative char class into this scheme // so we just conservatively create a mask and value that will always // succeed. + // Likewise for empty ranges (empty ranges can occur e.g. when + // compiling for one-byte subjects and impossible (non-one-byte) ranges + // have been removed). pos->mask = 0; pos->value = 0; } else { diff --git a/test/mjsunit/regress/regress-1263327.js b/test/mjsunit/regress/regress-1263327.js new file mode 100644 index 0000000000..2868294de0 --- /dev/null +++ b/test/mjsunit/regress/regress-1263327.js @@ -0,0 +1,5 @@ +// Copyright 2021 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. + +assertNull(/.?\ud833{6,}/gsu.exec());