[PATCH] D97610: [lld-macho] check minimum header length when opening linkable input files

Greg McGary via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 26 23:51:05 PST 2021


gkm created this revision.
gkm added a reviewer: lld-macho.
Herald added a reviewer: int3.
Herald added a project: lld-macho.
gkm requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Bifurcate the `readFile()` API into ...

- `readRawFile()` which performs no checks, and
- `readLinkableFile()` which enforces minimum length of 20 bytes, same as ld64

Similarly ...

- s/`addFile()`/`addLinkableFile()`/ because it wraps `readLinkableFile()`
- s/`addFileList()`/`addFileListFile()`/ to emphasize that the file list is itself contained in a file

There are no new tests because tweaks to existing tests are sufficient.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97610

Files:
  lld/MachO/Driver.cpp
  lld/MachO/DriverUtils.cpp
  lld/MachO/InputFiles.cpp
  lld/MachO/InputFiles.h
  lld/test/MachO/invalid/bad-archive.s
  lld/test/MachO/invalid/invalid-fat-narch.s
  lld/test/MachO/rename.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97610.326879.patch
Type: text/x-patch
Size: 10876 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210227/534ba6c2/attachment.bin>


More information about the llvm-commits mailing list