abbb54ed5a
Apply case-insensitive comparisons not only for the initial character, but for the entire prefix. This avoids degenerate behavior for patterns like /aaaa|AAAA|AAAA/i (i.e. generate a single 4-char prefix instead of four 1-char prefixes). Bug: v8:12472 Change-Id: Ib2b49fe73ca846a1b7ec90056cc64bdf5cf33026 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3398114 Reviewed-by: Patrick Thier <pthier@chromium.org> Commit-Queue: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/main@{#78668}
11 lines
410 B
JavaScript
11 lines
410 B
JavaScript
// 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.
|
|
|
|
const manyAs = 'A'.repeat(0x10000);
|
|
const manyas = manyAs.toLowerCase();
|
|
const re = RegExp('^(?:' + manyas + '|' + manyAs + '|' + manyAs + ')$', 'i');
|
|
|
|
// Shouldn't crash with a stack overflow.
|
|
assertThrows(() => manyas.replace(re, manyAs));
|