[PATCH] D93787: [analyzer] Fix crash caused by accessing empty map
Vince Bridgers via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Dec 26 13:59:35 PST 2020
vabridgers added inline comments.
================
Comment at: clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:1241
if (TheTok.getIdentifierInfo() == VariadicParamII) {
- TStream.injectRange(PrevParamMap.at(VariadicParamII));
+ if (PrevParamMap.find(VariadicParamII) != PrevParamMap.end())
+ TStream.injectRange(PrevParamMap.at(VariadicParamII));
----------------
steakhal wrote:
> Btw this lookup supposed to be successful. Always. Which suggests me that there are even more logic bug lurking there.
> Without using 'at' here we wouldn't notice it, which is lucky.
If we keep the at(), maybe it's worthwhile adding an assert for the key present?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93787/new/
https://reviews.llvm.org/D93787
More information about the cfe-commits
mailing list