[PATCH] D97600: [lld-macho] Implement options -rename_section -rename_segment
Greg McGary via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 26 17:54:29 PST 2021
gkm added inline comments.
================
Comment at: lld/MachO/InputFiles.cpp:109
auto *hdr = reinterpret_cast<const MachO::fat_header *>(buf);
- if (read32be(&hdr->magic) != MachO::FAT_MAGIC) {
+ if (mbref.getBufferSize() < sizeof(hdr->magic) ||
+ read32be(&hdr->magic) != MachO::FAT_MAGIC) {
----------------
FYI: This turned-up in my option-parsing test: when I omitted a sub-arg, then it swallowed `-o`, leaving `/dev/null` without a prefix, so it was interpreted as an input filename. Since its size was zero, ASAN caught the attempted read of the non-existent header.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97600/new/
https://reviews.llvm.org/D97600
More information about the llvm-commits
mailing list