forked from OSchip/llvm-project
[X86] Fix to X86LoadValueInjectionRetHardeningPass for possible segfault
`MBB.back()` could segfault if `MBB.empty()`. Fixed by checking for `MBB.empty()` in the loop. Differential Revision: https://reviews.llvm.org/D77584
This commit is contained in:
parent
aa4b37b2ac
commit
0505181006
|
@ -99,6 +99,9 @@ bool X86LoadValueInjectionRetHardeningPass::runOnMachineFunction(
|
|||
|
||||
bool Modified = false;
|
||||
for (auto &MBB : MF) {
|
||||
if (MBB.empty())
|
||||
continue;
|
||||
|
||||
MachineInstr &MI = MBB.back();
|
||||
if (MI.getOpcode() != X86::RETQ)
|
||||
continue;
|
||||
|
|
Loading…
Reference in New Issue