[PATCH] D140518: [lld-macho] Fix assert when splitting section
Keith Smiley via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 21 16:03:59 PST 2022
keith created this revision.
Herald added projects: lld-macho, All.
Herald added a reviewer: lld-macho.
keith requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Fixes https://github.com/llvm/llvm-project/issues/59649
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D140518
Files:
lld/MachO/InputFiles.cpp
Index: lld/MachO/InputFiles.cpp
===================================================================
--- lld/MachO/InputFiles.cpp
+++ lld/MachO/InputFiles.cpp
@@ -329,14 +329,14 @@
: buf + sec.offset,
static_cast<size_t>(sec.size)};
- auto splitRecords = [&](int recordSize) -> void {
+ auto splitRecords = [&](size_t recordSize) -> void {
if (data.empty())
return;
Subsections &subsections = section.subsections;
subsections.reserve(data.size() / recordSize);
for (uint64_t off = 0; off < data.size(); off += recordSize) {
auto *isec = make<ConcatInputSection>(
- section, data.slice(off, recordSize), align);
+ section, data.slice(off, std::min(data.size(), recordSize)), align);
subsections.push_back({off, isec});
}
section.doneSplitting = true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140518.484711.patch
Type: text/x-patch
Size: 932 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221222/7acdcf54/attachment.bin>
More information about the llvm-commits
mailing list