Skip to content

Commit bf52b6c

Browse files
MikeHolmanwyrichte
authored andcommitted
[CVE-2019-1197] Chakra JIT Type Confusion
1 parent 329d9d2 commit bf52b6c

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lib/Backend/GlobOptIntBounds.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,13 +1278,20 @@ GlobOpt::InvalidateInductionVariables(IR::Instr * instr)
12781278
}
12791279

12801280
// If this is an induction variable, then treat it the way the prepass would have if it had seen
1281-
// the assignment and the resulting change to the value number, and mark it as indeterminate.
1281+
// the assignment and the resulting change to the value number, and mark induction variables
1282+
// for the loop as indeterminate.
1283+
// We need to invalidate all induction variables for the loop, because we might have used the
1284+
// invalidated induction variable to calculate the loopCount, and this now invalid loopCount
1285+
// also impacts bound checks for secondary induction variables
12821286
for (Loop * loop = this->currentBlock->loop; loop; loop = loop->parent)
12831287
{
1284-
InductionVariable *iv = nullptr;
1285-
if (loop->inductionVariables && loop->inductionVariables->TryGetReference(dstSym->m_id, &iv))
1288+
if (loop->inductionVariables && loop->inductionVariables->ContainsKey(dstSym->m_id))
12861289
{
1287-
iv->SetChangeIsIndeterminate();
1290+
for (auto it = loop->inductionVariables->GetIterator(); it.IsValid(); it.MoveNext())
1291+
{
1292+
InductionVariable& inductionVariable = it.CurrentValueReference();
1293+
inductionVariable.SetChangeIsIndeterminate();
1294+
}
12881295
}
12891296
}
12901297
}

0 commit comments

Comments
 (0)