This is an archive of the discontinued LLVM Phabricator instance.

[clang-include-fixer] Fix incorrect ranking because of dangling references
ClosedPublic

Authored by danlark on Dec 20 2021, 5:47 AM.

Details

Summary

SymbolAndSignals stores SymbolInfo which stores two std::strings. Then
the values are stored in a llvm::DenseMap<llvm::StringRef, double>. When
the sorting is happening, SymbolAndSignals are swapped and thus because
of small string optimization some strings may become invalid. This
results in incorrect ranking.

This was detected when running new std::sort algorithm against llvm
toolchain. This could have been prevented with running llvm::sort and
EXPENSIVE_CHECKS. Unfortunately, no sanitizer yelled.

I don't have commit rights, kutdanila@yandex.ru Danila Kutenin

Diff Detail

Event Timeline

danlark created this revision.Dec 20 2021, 5:47 AM
danlark requested review of this revision.Dec 20 2021, 5:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 20 2021, 5:47 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
danlark edited the summary of this revision. (Show Details)Dec 20 2021, 5:48 AM
bkramer accepted this revision.Dec 20 2021, 6:56 AM

Thanks

This revision is now accepted and ready to land.Dec 20 2021, 6:56 AM