1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00

llvm-diff: Avoid crash with complex expressions

Summary: With complex IR, the difference engine can enter an inconsistent state where the instruction and block difference engines return different results. Prevent a crash by refusing to pop beyond the end of the vector.

Reviewers: rjmccall

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D80351
This commit is contained in:
Dominic Chen 2020-05-20 21:11:23 -04:00
parent 4ee52612b3
commit 69d36b0ea5

View File

@ -577,7 +577,7 @@ void FunctionDifferenceEngine::runBlockDiff(BasicBlock::iterator LStart,
DiffLogBuilder Diff(Engine.getConsumer());
// Drop trailing matches.
while (Path.back() == DC_match)
while (Path.size() && Path.back() == DC_match)
Path.pop_back();
// Skip leading matches.