[PATCH] D99389: [lld-macho] Implement -segprot

Vy Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 29 11:05:46 PDT 2021


oontvoo accepted this revision.
oontvoo added inline comments.


================
Comment at: lld/MachO/Driver.cpp:997-999
+    StringRef segName = arg->getValue(0);
+    uint32_t maxProt = parseProtection(arg->getValue(1));
+    uint32_t initProt = parseProtection(arg->getValue(2));
----------------
int3 wrote:
> oontvoo wrote:
> > Maybe I'm being paranoid - but should you check NumValues() to ensure they're 3 (and ignore the option if it's not) to avoid index-out-of-bounds?
> The option parser already handles that :)
> 
> I'll add a test to make sure.
Ah! That's right - you've already declared `3` values in the .td file. 
Thanks for adding the test anyway.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99389/new/

https://reviews.llvm.org/D99389



More information about the llvm-commits mailing list