[PATCH] D97757: [lld-macho] Rework length check when opening input files
Greg McGary via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 2 01:42:21 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(uint32_t) ||
+ read32be(&hdr->magic) != MachO::FAT_MAGIC) {
----------------
This is the new guard for adequate buffer size before reading the magic#
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97757/new/
https://reviews.llvm.org/D97757
More information about the llvm-commits
mailing list