Files
clang-p2996/llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp
Job Noorman 67f7efbbbb [JITLink][RISCV] Fix use-after-free in relax
Finalization of relaxation calls `finalizeBlockRelax` for every block in
the graph. This function, however, would iterate over //all// blocks in
the graph to remove `AlignRelaxable` edges. Since pointers to those
edges would still be stored in `RelaxEdges`, this caused a
use-after-free for graphs with multiple blocks.

This patch fixes this by only iterating over the edges of the current
block in `finalizeBlockRelax`.

Reviewed By: StephenFan

Differential Revision: https://reviews.llvm.org/D154844
2023-07-13 09:02:19 +02:00

34 KiB