-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
clangClang issues not falling into any other categoryClang issues not falling into any other categorycode-qualityquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
Description
If we look at Rewriter::InsertTextAfterToken, we see that here:
llvm-project/clang/lib/Rewrite/Rewriter.cpp
Lines 204 to 205 in 3aab3fe
| StartOffs += getRangeSize(SourceRange(Loc, Loc), rangeOpts); | |
| getEditBuffer(FID).InsertText(StartOffs, Str, /*InsertAfter*/true); |
getRangeSize may return a -1 which could lead to an overflow and would likely not be a good value when passed to InsertText.
This was flagged by static analysis. It looks like a valid issue but I am not sure. It seems like the function is not used anymore so maybe the correct fix is to remove it.
Metadata
Metadata
Assignees
Labels
clangClang issues not falling into any other categoryClang issues not falling into any other categorycode-qualityquestionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!