[PATCH] D58178: [clang-tidy] RawStringLiteralCheck: isRawStringLiteral doesn't check all erroneous cases

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 13 09:45:23 PST 2019


lebedev.ri added a comment.

In D58178#1396435 <https://reviews.llvm.org/D58178#1396435>, @gmit wrote:

> ? I'm sorry, but I disagree.
>
> Assert draws attention in the debug build only.
>
> In the release build asserts are not evaluated at all and the condition needs to be checked in the code that executes (if it makes sense and in this case it does as it causes reading out of string bounds).


What i'm saying is, do you agree that the `assert(QuotePos != StringRef::npos);` happens before `return (QuotePos != StringRef::npos) && ....` ?
If you build with asserts enabled, that your original code which caused it to "read from memory randomly"
will trigger that assertion. Even with this fix. So the fix is not correct.

> I don't have a test as I don't have an input file that causes this behaviour.

It's quite easy to trim down the source that crashes down to something usable with https://embed.cs.utah.edu/creduce/
The end result won't resemble anything the original code was, no proprietary secrets will be leaked.
Without test case, there is nothing do to here.


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58178/new/

https://reviews.llvm.org/D58178





More information about the cfe-commits mailing list