[PATCH] D116769: [ifs] Allow llvm-ifs to generate text stub from elf stub
Haowei Wu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 11 14:40:27 PST 2022
haowei added inline comments.
================
Comment at: llvm/lib/InterfaceStub/ELFObjHandler.cpp:382
+ return StringRef(reinterpret_cast<const char *>(*DataOrErr),
+ DynEnt.StrSize);
+ }
----------------
mcgrathr wrote:
> Is there anything that validates that this size is within the bounds of the memory returned by toMappedAddr?
There is no validating in this implementation and I think that is an issue. It would need a rewrite or reimplement of toMappedAddr to validate if the size is within the bounds of the same PT_LOAD segment returned by toMappedAddr. But if we just want validate if the size is still within all PT_LOAD, we can probably do:
```
Expected<const uint8_t *> SecPtr = ElfFile.toMappedAddr(EntAddr);
Expected<const uint8_t *> SecEndPtr = ElfFile.toMappedAddr(EntAddr + DynEnt.StrSize);
```
And check if SecPtr and SecEndPtr contains any errors. Does that looks OK to you?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116769/new/
https://reviews.llvm.org/D116769
More information about the llvm-commits
mailing list