Skip to content

[NFC,SHT_LLVM_BB_ADDR_MAP] Fix undefined behaviour in ELF.cpp. #115830

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/lib/Object/ELF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {
Expand Down
Loading