Commit 86be87df authored by Jakob Kummerow's avatar Jakob Kummerow Committed by V8 LUCI CQ

[bigint] Fix object literal property keys like `0x0n`

Fixed: chromium:1327321
Change-Id: I4868e0127b9dd14a0812cafca1681280534faa46
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3652788Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80661}
parent 4ba3b515
......@@ -976,6 +976,10 @@ class StringToBigIntHelper : public StringToIntHelper<IsolateT> {
std::unique_ptr<char[]> DecimalString(bigint::Processor* processor) {
DCHECK_EQ(behavior_, Behavior::kLiteral);
this->ParseInt();
if (this->state() == State::kZero) {
// Input may have been "0x0" or similar.
return std::unique_ptr<char[]>(new char[2]{'0', '\0'});
}
DCHECK_EQ(this->state(), State::kDone);
int num_digits = accumulator_.ResultLength();
base::SmallVector<bigint::digit_t, 8> digit_storage(num_digits);
......
// Copyright 2022 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.
for (let o of [{0b0n: 0}, {0B0n: 1},
{0o0n: 2}, {0O0n: 3},
{0x0n: 4}, {0X0n: 5},
{0n: 6}]) {
assertEquals("0", Object.getOwnPropertyNames(o)[0]);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment