[PATCH] D77584: [X86] Fix to X86LoadValueInjectionRetHardeningPass for possible segfault
Scott Constable via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 6 13:37:55 PDT 2020
sconstab created this revision.
sconstab added a reviewer: craig.topper.
Herald added a subscriber: hiraditya.
`MBB.back()` could segfault if `MBB.empty()`. Fixed by checking for `MBB.empty()` in the loop.
https://reviews.llvm.org/D77584
Files:
llvm/lib/Target/X86/X86LoadValueInjectionRetHardening.cpp
Index: llvm/lib/Target/X86/X86LoadValueInjectionRetHardening.cpp
===================================================================
--- llvm/lib/Target/X86/X86LoadValueInjectionRetHardening.cpp
+++ llvm/lib/Target/X86/X86LoadValueInjectionRetHardening.cpp
@@ -99,6 +99,9 @@
bool Modified = false;
for (auto &MBB : MF) {
+ if (MBB.empty())
+ continue;
+
MachineInstr &MI = MBB.back();
if (MI.getOpcode() != X86::RETQ)
continue;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77584.255470.patch
Type: text/x-patch
Size: 461 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200406/7f573494/attachment.bin>
More information about the llvm-commits
mailing list