[PATCH] D157300: [lld-macho]Rework error-checking in peeking at first-member in archive to avoid segfault.
Vy Nguyen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 8 06:52:24 PDT 2023
oontvoo added a comment.
In D157300#4567865 <https://reviews.llvm.org/D157300#4567865>, @MaskRay wrote:
>> calling getMemoryBufferRef() on an empty archive can sometimes trigger segfault so the code should check before calling this. this seems like a bug in the Archive API but that can be fixed separately.
>
> Is there a test case? When is "sometimes"?
reducing the test-case further, I think it's safe to change "sometimes" => "100% of the time".
Test case is simply linking with at least one empty archive in the input
(empty archive produced by `llvm-ar --format=darwin rcs libempty.a`
This will produce an empty archive but the `::isEmpty()` method on the API doesn't return true, so getBufferRef() would crash.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157300/new/
https://reviews.llvm.org/D157300
More information about the llvm-commits
mailing list