Includer cache could get into a bad state when a main file went bad and
added back afterwards. This fixes the issue by getting rid of the main file to
first pointer completely to make sure we don't try invalidating again.
Details
Details
- Reviewers
sammccall - Commits
- rG60e19f6752b7: [clangd] Fix use-after-free in HeaderIncluderCache
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
- Rather than dropping the entry, perform an extra check during invalidate. As
the entry actually backs the data for main file strings in associations.
clang-tools-extra/clangd/TUScheduler.cpp | ||
---|---|---|
289 | Hmm, this leaves MainToFirst pointing to an invalidated entry. Then I think we need no code changes elsewhere, as update() already checks if First already exists before invalidating. (This special case would occur on a rarer path, but the real reason for my preference is that I think the data structure is easier to interpret) |
clang-tools-extra/clangd/TUScheduler.cpp | ||
---|---|---|
289 | Thanks! Yeah that makes sense + now there's a point for First being a reference :P |
Hmm, this leaves MainToFirst pointing to an invalidated entry.
Would it make more sense to just null out the value (i.e. First here)?
Then I think we need no code changes elsewhere, as update() already checks if First already exists before invalidating.
(This special case would occur on a rarer path, but the real reason for my preference is that I think the data structure is easier to interpret)