Commit 317ce117 authored by dcarney's avatar dcarney Committed by Commit bot

add 0 length guard in IsNonArrayIndexInteger

TBR=verwaest@chromium.org

BUG=466086
LOG=N

Review URL: https://codereview.chromium.org/998213002

Cr-Commit-Position: refs/heads/master@{#27151}
parent d4696c48
......@@ -509,7 +509,7 @@ bool IsNonArrayIndexInteger(String* string) {
uint16_t buffer[kBufferSize];
int offset = 0;
const int length = string->length();
DCHECK_NE(0, length);
if (length == 0) return false;
// First iteration, check for minus, 0 followed by anything else, etc.
int to = std::min(offset + kUint32MaxChars, length);
{
......
......@@ -374,6 +374,7 @@ static void CheckNonArrayIndex(bool expected, const char* chars) {
TEST(NonArrayIndexParsing) {
auto isolate = CcTest::i_isolate();
HandleScope scope(isolate);
CheckNonArrayIndex(false, "");
CheckNonArrayIndex(false, "-");
CheckNonArrayIndex(false, "0");
CheckNonArrayIndex(false, "01");
......
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