Skip to content

Commit 7f0d390

Browse files
pleathatulkatti
authored andcommitted
[CVE-2019-1062] Chakra JIT Type Confusion
1 parent d4e767f commit 7f0d390

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

lib/Backend/Opnd.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -962,7 +962,8 @@ PropertySymOpnd::IsObjectHeaderInlined() const
962962
bool
963963
PropertySymOpnd::ChangesObjectLayout() const
964964
{
965-
JITTypeHolder cachedType = this->IsMono() ? this->GetType() : this->GetFirstEquivalentType();
965+
JITTypeHolder cachedType = this->HasInitialType() ? this->GetInitialType() :
966+
this->IsMono() ? this->GetType() : this->GetFirstEquivalentType();
966967

967968
JITTypeHolder finalType = this->GetFinalType();
968969

@@ -987,13 +988,11 @@ PropertySymOpnd::ChangesObjectLayout() const
987988
// This is the case where the type transition actually occurs. (This is the only case that's detectable
988989
// during the loop pre-pass, since final types are not in place yet.)
989990

990-
Assert(cachedType != nullptr && Js::DynamicType::Is(cachedType->GetTypeId()));
991-
992-
const JITTypeHandler * cachedTypeHandler = cachedType->GetTypeHandler();
993991
const JITTypeHandler * initialTypeHandler = initialType->GetTypeHandler();
994992

995-
return cachedTypeHandler->GetInlineSlotCapacity() != initialTypeHandler->GetInlineSlotCapacity() ||
996-
cachedTypeHandler->GetOffsetOfInlineSlots() != initialTypeHandler->GetOffsetOfInlineSlots();
993+
// If no final type has been set in the forward pass, then we have no way of knowing how the object shape will evolve here.
994+
// If the initial type is object-header-inlined, assume that the layout may change.
995+
return initialTypeHandler->IsObjectHeaderInlinedTypeHandler();
997996
}
998997

999998
return false;

0 commit comments

Comments
 (0)