Skip to content

Commit 64cd4d2

Browse files
akroshgAtul Katti
authored andcommitted
[CVE-2018-8275] Edge - Chakra Array.splice UAF RCE - Zero Day Initiative
We have cleared the segment map before ArraySpecies. The ArraySpecies is re-entrant and once we have come back from you user code we may have constructed the segment map. This segment map is not valid anymore as we are doing splicing. Fixed this by Clearing the segment map.
1 parent f9b1cde commit 64cd4d2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/Runtime/Library/JavascriptArray.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5682,6 +5682,7 @@ using namespace Js;
56825682
}
56835683

56845684
pArr->InvalidateLastUsedSegment(); // lastUsedSegment might be 0-length and discarded above
5685+
pArr->ClearSegmentMap();
56855686
#ifdef VALIDATE_ARRAY
56865687
pArr->ValidateArray();
56875688
#endif
@@ -5862,6 +5863,7 @@ using namespace Js;
58625863
}
58635864

58645865
pArr->InvalidateLastUsedSegment();
5866+
pArr->ClearSegmentMap();
58655867
}
58665868

58675869
#ifdef VALIDATE_ARRAY
@@ -6824,6 +6826,7 @@ using namespace Js;
68246826
}
68256827
SetHasNoMissingValues();
68266828
this->InvalidateLastUsedSegment();
6829+
this->ClearSegmentMap();
68276830

68286831
#ifdef VALIDATE_ARRAY
68296832
ValidateArray();
@@ -7628,6 +7631,7 @@ using namespace Js;
76287631
}
76297632

76307633
pArr->InvalidateLastUsedSegment();
7634+
pArr->ClearSegmentMap();
76317635

76327636
// it is possible for valueOf accessors for the start or deleteLen
76337637
// arguments to modify the size of the array. Since the resulting size of the array
@@ -7656,6 +7660,7 @@ using namespace Js;
76567660
failFastOnError.Completed();
76577661

76587662
newArr->InvalidateLastUsedSegment();
7663+
newArr->ClearSegmentMap();
76597664

76607665
#ifdef VALIDATE_ARRAY
76617666
newArr->ValidateArray();
@@ -8107,6 +8112,7 @@ using namespace Js;
81078112

81088113
pArr->InvalidateLastUsedSegment();
81098114
pArr->length += unshiftElements;
8115+
pArr->ClearSegmentMap();
81108116

81118117
#ifdef VALIDATE_ARRAY
81128118
pArr->ValidateArray();

0 commit comments

Comments
 (0)