We were taking a reference to a value in loadedDylibs, which in turn
called make<DylibFile>(), which could then recursively call
loadDylibs, which would then potentially resize loadedDylibs and
invalidate that reference.
Fixes PR50101.
Differential D101175
[lld-macho] Fix use-after-free in loadDylib() int3 on Apr 23 2021, 9:12 AM. Authored by
Details
We were taking a reference to a value in loadedDylibs, which in turn Fixes PR50101.
Diff Detail
Event TimelineComment Actions
It *was* caught by a sanitizer in PR50101. The tricky bit here is that our tests don't trigger a hashmap resize (since the inputs are small), so the ASAN contbuilds didn't catch it. (Maybe there's value in having a test mode where hashmaps are aggressively resized/rehashed, e.g. on every write. Much like how llvm::sort forces std::sort to be unstable to catch nondeterminism...) |