[PATCH] D154844: [JITLink][RISCV] Fix use-after-free in relax

Job Noorman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 00:02:42 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG67f7efbbbb04: [JITLink][RISCV] Fix use-after-free in relax (authored by jobnoorman).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154844/new/

https://reviews.llvm.org/D154844

Files:
  llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp


Index: llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp
===================================================================
--- llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp
+++ llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp
@@ -744,13 +744,11 @@
   // Remove AlignRelaxable edges: all other relaxable edges got modified and
   // will be used later while linking. Alignment is entirely handled here so we
   // don't need these edges anymore.
-  for (auto *B : G.blocks()) {
-    for (auto IE = B->edges().begin(); IE != B->edges().end();) {
-      if (IE->getKind() == AlignRelaxable)
-        IE = B->removeEdge(IE);
-      else
-        ++IE;
-    }
+  for (auto IE = Block.edges().begin(); IE != Block.edges().end();) {
+    if (IE->getKind() == AlignRelaxable)
+      IE = Block.removeEdge(IE);
+    else
+      ++IE;
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154844.539864.patch
Type: text/x-patch
Size: 833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230713/e417a315/attachment.bin>


More information about the llvm-commits mailing list