gmit created this revision. gmit added a reviewer: alexfh. gmit added a project: clang-tools-extra. Herald added a project: clang. Herald added a subscriber: cfe-commits.
isRawStringLiteral will read from memory randomly if double quote is not found. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D58178 Files: RawStringLiteralCheck.cpp Index: RawStringLiteralCheck.cpp =================================================================== --- RawStringLiteralCheck.cpp +++ RawStringLiteralCheck.cpp @@ -38,7 +38,8 @@ // Already a raw string literal if R comes before ". const size_t QuotePos = Text.find('"'); assert(QuotePos != StringRef::npos); - return (QuotePos > 0) && (Text[QuotePos - 1] == 'R'); + return (QuotePos != StringRef::npos) && (QuotePos > 0) && + (Text[QuotePos - 1] == 'R'); } bool containsEscapedCharacters(const MatchFinder::MatchResult &Result,
Index: RawStringLiteralCheck.cpp =================================================================== --- RawStringLiteralCheck.cpp +++ RawStringLiteralCheck.cpp @@ -38,7 +38,8 @@ // Already a raw string literal if R comes before ". const size_t QuotePos = Text.find('"'); assert(QuotePos != StringRef::npos); - return (QuotePos > 0) && (Text[QuotePos - 1] == 'R'); + return (QuotePos != StringRef::npos) && (QuotePos > 0) && + (Text[QuotePos - 1] == 'R'); } bool containsEscapedCharacters(const MatchFinder::MatchResult &Result,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits