[llvm] [NFC,SHT_LLVM_BB_ADDR_MAP] Fix ub in ELF.cpp. (PR #115830)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 11 23:21:24 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-binary-utilities
Author: Rahman Lavaee (rlavaee)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/115830.diff
1 Files Affected:
- (modified) llvm/lib/Object/ELF.cpp (+1-1)
``````````diff
diff --git a/llvm/lib/Object/ELF.cpp b/llvm/lib/Object/ELF.cpp
index 9a9e762d1e51d6..545a672c05c8a3 100644
--- a/llvm/lib/Object/ELF.cpp
+++ b/llvm/lib/Object/ELF.cpp
@@ -823,7 +823,6 @@ decodeBBAddrMapImpl(const ELFFile<ELFT> &EF,
uint32_t NumBlocksInBBRange = 0;
uint32_t NumBBRanges = 1;
typename ELFFile<ELFT>::uintX_t RangeBaseAddress = 0;
- std::vector<BBAddrMap::BBEntry> BBEntries;
if (FeatEnable.MultiBBRange) {
NumBBRanges = readULEB128As<uint32_t>(Data, Cur, ULEBSizeErr);
if (!Cur || ULEBSizeErr)
@@ -851,6 +850,7 @@ decodeBBAddrMapImpl(const ELFFile<ELFT> &EF,
RangeBaseAddress = *AddressOrErr;
NumBlocksInBBRange = readULEB128As<uint32_t>(Data, Cur, ULEBSizeErr);
}
+ std::vector<BBAddrMap::BBEntry> BBEntries;
for (uint32_t BlockIndex = 0; !MetadataDecodeErr && !ULEBSizeErr && Cur &&
(BlockIndex < NumBlocksInBBRange);
++BlockIndex) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/115830
More information about the llvm-commits
mailing list