Skip to content

Commit f49b9e9

Browse files
committed
deps: patch V8 to 7.0.276.35
Refs: v8/v8@7.0.276.32...7.0.276.35 PR-URL: #24056 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
1 parent 6f54a7a commit f49b9e9

File tree

6 files changed

+50
-37
lines changed

6 files changed

+50
-37
lines changed

deps/v8/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 7
1212
#define V8_MINOR_VERSION 0
1313
#define V8_BUILD_NUMBER 276
14-
#define V8_PATCH_LEVEL 32
14+
#define V8_PATCH_LEVEL 35
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

deps/v8/infra/testing/builders.pyl

-9
Original file line numberDiff line numberDiff line change
@@ -685,11 +685,6 @@
685685
{'name': 'mozilla'},
686686
],
687687
},
688-
'V8 Linux - presubmit': {
689-
'tests': [
690-
{'name': 'presubmit'},
691-
],
692-
},
693688
'V8 Linux - shared': {
694689
'tests': [
695690
{'name': 'mozilla'},
@@ -1514,7 +1509,6 @@
15141509
},
15151510
'tests': [
15161511
{'name': 'mozilla'},
1517-
{'name': 'presubmit'},
15181512
{'name': 'test262'},
15191513
{'name': 'v8testing'},
15201514
],
@@ -1527,7 +1521,6 @@
15271521
},
15281522
'tests': [
15291523
{'name': 'mozilla'},
1530-
{'name': 'presubmit'},
15311524
{'name': 'test262'},
15321525
{'name': 'v8testing', 'shards': 3},
15331526
],
@@ -1540,7 +1533,6 @@
15401533
},
15411534
'tests': [
15421535
{'name': 'mozilla'},
1543-
{'name': 'presubmit'},
15441536
{'name': 'test262'},
15451537
{'name': 'v8testing'},
15461538
],
@@ -1553,7 +1545,6 @@
15531545
},
15541546
'tests': [
15551547
{'name': 'mozilla'},
1556-
{'name': 'presubmit'},
15571548
{'name': 'test262'},
15581549
{'name': 'v8testing', 'shards': 3},
15591550
],

deps/v8/src/runtime/runtime-array.cc

+11-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,15 @@ Object* RemoveArrayHolesGeneric(Isolate* isolate, Handle<JSReceiver> receiver,
145145
MAYBE_RETURN(delete_result, ReadOnlyRoots(isolate).exception());
146146
}
147147

148-
return *isolate->factory()->NewNumberFromUint(result);
148+
// TODO(jgruber, szuend, chromium:897512): This is a workaround to prevent
149+
// returning a number greater than array.length to Array.p.sort, which could
150+
// trigger OOB accesses. There is still a correctness bug here though in
151+
// how we shift around undefineds and delete elements in the two blocks above.
152+
// This needs to be fixed soon.
153+
const uint32_t number_of_non_undefined_elements = std::min(limit, result);
154+
155+
return *isolate->factory()->NewNumberFromUint(
156+
number_of_non_undefined_elements);
149157
}
150158

151159
// Collects all defined (non-hole) and non-undefined (array) elements at the
@@ -162,6 +170,7 @@ Object* RemoveArrayHoles(Isolate* isolate, Handle<JSReceiver> receiver,
162170
Handle<JSObject> object = Handle<JSObject>::cast(receiver);
163171
if (object->HasStringWrapperElements()) {
164172
int len = String::cast(Handle<JSValue>::cast(object)->value())->length();
173+
DCHECK_LE(len, limit);
165174
return Smi::FromInt(len);
166175
}
167176

@@ -284,6 +293,7 @@ Object* RemoveArrayHoles(Isolate* isolate, Handle<JSReceiver> receiver,
284293
}
285294
}
286295

296+
DCHECK_LE(result, limit);
287297
return *isolate->factory()->NewNumberFromUint(result);
288298
}
289299

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2018 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
// Fill up the Array prototype's elements.
6+
for (let i = 0; i < 100; i++) Array.prototype.unshift(3.14);
7+
8+
// Create a holey double elements array.
9+
const o31 = [1.1];
10+
o31[37] = 2.2;
11+
12+
// Concat converts to dictionary elements.
13+
const o51 = o31.concat(false);
14+
15+
// Set one element to undefined to trigger the movement bug.
16+
o51[0] = undefined;
17+
18+
assertEquals(o51.length, 39);
19+
20+
// Sort triggers the bug.
21+
o51.sort();
22+
23+
// TODO(chromium:897512): The length should be 39.
24+
assertEquals(o51.length, 101);

deps/v8/third_party/v8/builtins/array-sort.tq

+14-26
Original file line numberDiff line numberDiff line change
@@ -1742,7 +1742,6 @@ module array {
17421742

17431743
// 2. Let obj be ? ToObject(this value).
17441744
const obj: JSReceiver = ToObject(context, receiver);
1745-
let map: Map = obj.map;
17461745

17471746
const sort_state: FixedArray =
17481747
AllocateZeroedFixedArray(kSortStateSize);
@@ -1752,25 +1751,27 @@ module array {
17521751
sort_state[kUserCmpFnIdx] = comparefnObj;
17531752
sort_state[kSortComparePtrIdx] =
17541753
comparefnObj != Undefined ? SortCompareUserFn : SortCompareDefault;
1755-
sort_state[kInitialReceiverMapIdx] = map;
17561754
sort_state[kBailoutStatusIdx] = kSuccess;
17571755

1756+
// 3. Let len be ? ToLength(? Get(obj, "length")).
1757+
const len: Number =
1758+
ToLength_Inline(context, GetProperty(context, obj, 'length'));
1759+
if (len < 2) return receiver;
1760+
1761+
// TODO(szuend): Investigate performance tradeoff of skipping this step
1762+
// for PACKED_* and handling Undefineds during sorting.
1763+
const nofNonUndefined: Smi = PrepareElementsForSort(context, obj, len);
1764+
assert(nofNonUndefined <= len);
1765+
1766+
let map: Map = obj.map;
1767+
sort_state[kInitialReceiverMapIdx] = map;
1768+
sort_state[kInitialReceiverLengthIdx] = len;
1769+
17581770
try {
17591771
const a: JSArray = cast<JSArray>(obj) otherwise slow;
17601772
const elementsKind: ElementsKind = map.elements_kind;
17611773
if (!IsFastElementsKind(elementsKind)) goto slow;
17621774

1763-
// 3. Let len be ? ToLength(? Get(obj, "length")).
1764-
const len: Smi = a.length_fast;
1765-
if (len < 2) return receiver;
1766-
1767-
// TODO(szuend): Investigate performance tradeoff of skipping this step
1768-
// for PACKED_* and handling Undefineds during sorting.
1769-
const nofNonUndefined: Smi = PrepareElementsForSort(context, obj, len);
1770-
assert(a.map == map);
1771-
1772-
sort_state[kInitialReceiverLengthIdx] = len;
1773-
17741775
if (IsDoubleElementsKind(elementsKind)) {
17751776
InitializeSortStateAccessor<FastDoubleElements>(sort_state);
17761777
} else if (elementsKind == PACKED_SMI_ELEMENTS) {
@@ -1781,19 +1782,6 @@ module array {
17811782
ArrayTimSort(context, sort_state, nofNonUndefined);
17821783
}
17831784
label slow {
1784-
// 3. Let len be ? ToLength(? Get(obj, "length")).
1785-
const len: Number =
1786-
ToLength_Inline(context, GetProperty(context, obj, 'length'));
1787-
1788-
if (len < 2) return receiver;
1789-
const nofNonUndefined: Smi = PrepareElementsForSort(context, obj, len);
1790-
1791-
sort_state[kInitialReceiverLengthIdx] = len;
1792-
1793-
// Reload the map, PrepareElementsForSort might have changed the
1794-
// elements kind.
1795-
map = obj.map;
1796-
17971785
if (map.elements_kind == DICTIONARY_ELEMENTS && IsExtensibleMap(map) &&
17981786
!IsCustomElementsReceiverInstanceType(map.instance_type)) {
17991787
InitializeSortStateAccessor<DictionaryElements>(sort_state);
File renamed without changes.

0 commit comments

Comments
 (0)